Swift Classes That Conform to Protocols
The other day, someone asked how to have a variable which stores a
UIView
that also conforms to a protocol. In Objective-C, you would simply writeUIView<HeaderViewProtocol>
. In current Swift, you can’t write something like that. This posts shows a two workarounds.