When to use enums inside classes [on hold]











up vote
-1
down vote

favorite












I have a code that looks like this:



class PermissionsManager {
static let shared = PermissionsManager()

public enum PermissionType {
case contacts
case calendar
}
}


This got me thinking, while syntactically this is allowed, when are the times you would want to nest an enum inside a class? Is it a good practice in this instance?










share|improve this question













put on hold as off-topic by VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger

If this question can be reworded to fit the rules in the help center, please edit the question.

















    up vote
    -1
    down vote

    favorite












    I have a code that looks like this:



    class PermissionsManager {
    static let shared = PermissionsManager()

    public enum PermissionType {
    case contacts
    case calendar
    }
    }


    This got me thinking, while syntactically this is allowed, when are the times you would want to nest an enum inside a class? Is it a good practice in this instance?










    share|improve this question













    put on hold as off-topic by VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger 2 days ago


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger

    If this question can be reworded to fit the rules in the help center, please edit the question.















      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I have a code that looks like this:



      class PermissionsManager {
      static let shared = PermissionsManager()

      public enum PermissionType {
      case contacts
      case calendar
      }
      }


      This got me thinking, while syntactically this is allowed, when are the times you would want to nest an enum inside a class? Is it a good practice in this instance?










      share|improve this question













      I have a code that looks like this:



      class PermissionsManager {
      static let shared = PermissionsManager()

      public enum PermissionType {
      case contacts
      case calendar
      }
      }


      This got me thinking, while syntactically this is allowed, when are the times you would want to nest an enum inside a class? Is it a good practice in this instance?







      object-oriented swift enum






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      avismara

      1376




      1376




      put on hold as off-topic by VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger 2 days ago


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger

      If this question can be reworded to fit the rules in the help center, please edit the question.




      put on hold as off-topic by VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger 2 days ago


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – VisualMelon, BCdotWEB, Martin R, t3chb0t, Mathias Ettinger

      If this question can be reworded to fit the rules in the help center, please edit the question.



























          active

          oldest

          votes






















          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei