title: Swift: enum type as a property
body: <p>Can I store enum type (or class) conforms to protocol to var inside my class?</p>
  
  <pre><code>class MyClass : UIViewController {
      var sourceType : InformationServiceItemProtocol = InformationServiceMenuItem.self
  }
  </code></pre>
  
  <p>Getting compile error:</p>
  
  <pre><code>Type 'InformationServiceMenuItem.Type' Does not conform to protocol 'InformationServiceItemProtocol'
  </code></pre>
  
  <p>cause I getting no compile error here, but here is no single word about protocol:</p>
  
  <pre><code>class MyClass : UIViewController {
      var sourceType = InformationServiceMenuItem.self
  }
  </code></pre>
  
  <p>achieved it by putting </p>
  
  <pre><code>var sourceType : InformationServiceItemProtocol.Type = InformationServiceMenuItem.self
  </code></pre>
  
  <p>no compile errors here, but I can't use it, anywhere I'm trying to access sourceType I'm getting compilation failed with</p>
  
  <pre><code>1.  While emitting IR SIL function @_TFC12AeroflotIPad28InformationServiceSideMenuVC9tableViewfS0_FTGSQCSo11UITableView_21cellForRowAtIndexPathGSQCSo11NSIndexPath__GSQCSo15UITableViewCell_ for 'tableView' at /Users/PathToProject/InformationServiceSideMenuVC.swift:25:11
  &lt;unknown&gt;:0: error: unable to execute command: Segmentation fault: 11
  &lt;unknown&gt;:0: error: swift frontend command failed due to signal (use -v to see invocation)
  Command /Volumes/Macintosh_Aditional_SSD/AlsoApplications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254
  </code></pre>
  
  <p>for example:</p>
  
  <pre><code>protocol InformationServiceItemProtocol {
      var title: String { get }
      var subitems: InformationServiceItemProtocol[]? { get }
      class func count () -&gt; Int
  }
  
  override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -&gt; Int {
      return sourceType.count() // if I'll replace it with 'return 0' no compilation failed message
  }
  </code></pre>