title: Swift 2 Protocol - Property with a Generic Type?
body: <p>In my project using Swift 2, I am dealing with 2 protocols, <code>MyViewControllerProtocol</code> and <code>MyViewModelProtocol</code>. I want all View Controllers to conform to <code>MyViewControllerProtocol</code>. This protocol will require a property. The property should conform to the <code>MyViewModel</code> protocol. </p>
  
  <p>What I was thinking would work here would be something like this:</p>
  
  <pre><code>protocol MyViewControllerProtocol {
      var viewModel: &lt;T:MyViewModelProtocol&gt; { get set }
  } 
  
  class MyCustomViewModel: MyViewModelProtocol {
       // Implementation here
  }
  </code></pre>
  
  <p>Then for the View Controller:</p>
  
  <pre><code>class ViewController: UIViewController, MyViewControllerProtocol {
      var viewModel: MyCustomViewModel {
          // Getter and Setter implementations here
      }
  }
  </code></pre>
  
  <p>I am most likely thinking about this wrong. This will not compile, and I haven't yet seen this type of implementation in conjunction with a property. Is there some other pattern that could accomplish what I'm trying to do here?</p>