title: How to declare enums in Swift of a particular class type?
body: <p>I am trying to create a class and use that class as the type for my new enum like shown below.</p>
  
  <pre><code>class Abc{
      var age  = 25
      var name = "Abhi"
  }
  
  enum TestEnum : Abc {
      case firstCase
      case secondCase
  }
  </code></pre>
  
  <p>I am getting following error in playground .</p>
  
  <pre><code>error: raw type 'Abc' is not expressible by any literal
  </code></pre>
  
  <p>So i tried conforming to  RawRepresentable protocol like this.</p>
  
  <pre><code>extension TestEnum : RawRepresentable{
      typealias RawValue = Abc
  
      init?(rawValue:RawValue ) {
          switch rawValue {
          case Abc.age :
              self = .firstCase
  
          case Abc.name :
              self = .secondCase
          }
      }
  
      var rawValue : RawValue {
          switch self{
  
          case .firstCase :
              return Abc.age
  
          case .secondCase :
              return Abc.name
          }
      }
  }
  </code></pre>
  
  <p>I am getting following errors after this :</p>
  
  <pre><code>error: raw type 'Abc' is not expressible by any literal
  error: instance member 'age' cannot be used on type 'Abc'
  error: instance member 'name' cannot be used on type 'Abc'
  </code></pre>
  
  <p>What is the proper way to declare enums of a certain class type, not getting clear idea on this. Anyone help?</p>