title: How to cast controller to a specific protocol instead of a class in Swift?
body: <p>This is my <code>protocol</code>:</p>
  
  <pre><code>protocol DBViewAnimationTransitioning {
      var viewForAnimation: UIView? { get set }
  }
  </code></pre>
  
  <p>Example of usage inside <code>prepareForSegue:</code>:</p>
  
  <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
      if let controller = segue.destinationViewController as? DBViewAnimationTransitioning {
          controller.viewForAnimation = sender as? UIView //cannot assign to to viewForAnimation in controller
      }
  }
  </code></pre>
  
  <p>Everything is fine when I cast to specific controller f.e. <code>DBFindViewController</code>. But I need to cast this to the specific <code>protocol</code> not <code>class</code>. How to accomplish this?</p>