title: associated protocol conformance error swift 2.0
body: <p>I am aware of <a href="https://stackoverflow.com/questions/30033138/testing-protocol-conformance-with-associated-types">this post</a> which presents the same problem as me, but is unanswered and old, so i thought id refresh it here. </p>
  
  <pre><code>//: Playground - noun: a place where people can play
  import UIKit
  
  protocol BaseViewModel { }
  
  protocol SomeCellViewModelInterface : BaseViewModel { }
  protocol AnotherCellViewModelInterface : BaseViewModel { }
  
  protocol BaseCell {
  
      typealias T
      func configure(viewmodel: T)
  }
  
  //
  
  class someCell : UIView, BaseCell {
      typealias T = SomeCellViewModelInterface
      func configure(viewmodel: T) {
          // awesome
      }
  }
  
  class someOtherCell : UIView, BaseCell {
      typealias T = AnotherCellViewModelInterface
      func configure(viewmodel: T) {
          // do stuff
      }
  }
  
  
  // the concrete implementations of viewmodels and actually using this UI is ultimatley in another .framework
  
  class ConcreteSomeCellVM : SomeCellViewModelInterface { }
  class ConcreteAnotherCellVM : AnotherCellViewModelInterface { }
  
  var viewModel = ConcreteSomeCellVM()
  
  let views: [UIView] = [someCell(), someOtherCell(), UIView()]
  </code></pre>
  
  <p>This is a rudimentary example of what I need but it illustrates the point</p>
  
  <pre><code>for v in views {
  
      // A
      if let cell = v as? someCell {
          cell.configure(viewModel)
      }
  
      // B
      if let cell = v as? BaseCell {
          cell.configure(viewModel)
      }  
  }
  </code></pre>
  
  <p>Block A works, but needs to know the concrete cell class, so if i have a list of many different cells, some that I do not know the concrete type of this won't work.</p>
  
  <p>Block B throws this error:</p>
  
  <blockquote>
    <p>error: protocol 'BaseCell' can only be used as a generic constraint because it has Self or associated type requirements</p>
  </blockquote>
  
  <p>Is there a way that Block B can be achieved?</p>