This is my protocol
:
protocol DBViewAnimationTransitioning {
var viewForAnimation: UIView? { get set }
}
Example of usage inside prepareForSegue:
:
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
}
}
Everything is fine when I cast to specific controller f.e. DBFindViewController
. But I need to cast this to the specific protocol
not class
. How to accomplish this?
So the solution is simple:
or: