In Objective-C, it's possible to write something like that:
@property(retain) UIView<Protocol1, Protocol2, ...> *myView;
But how can I write this code in swift?
I already know how to make a property conform to many protocols, but it does not work by using the inheritance:
var myView: ??? protocol<Protocol1, Protocol2, ...>
Edit:
I use many UIView
subtypes like UIImageView
, UILabel
or others, and I need to use some of the UIView
properties plus some methods defined in the protocols. In the worst case I could create a UIViewProtocol
with the needed properties, but I would know if it is possible in Swift to declare a property/variable with a type and some protocol to conform with.