Polymorphism in Protocols

I don’t remember exactly how I stumbled across this but thought it would be useful and maybe save someone else a few minutes of debugging.  It’s also great to know how this bit of polymorphism is handled in Swift.  If you create an object that conforms to a protocol method that is overridden you can still access the overridden behavior by specifying the protocol.  That sounds more complicated than it is, just take a look at this trivial and contrived code:

ext

Considering the push toward protocol oriented design I can only imagine this will be cropping up over time.

Polymorphism in Protocols