This class has 2 properties that accepts any object (subclass of NSObject
) and must conform to MyProtocol
and OtherProtocol
example:
@interface SomeClass {
}
myViewController.abc = [SomeClass new]; // error this class does not conform to MyProtocol
@interface AnotherClass<MyProtocol> {
}
myViewController.abc = [AnotherClass new]; // works
myViewController.def = [AnotherClass new]; // error AnotherClass does not conform to OtherProtocol
This is the new protocol oriented programming which you should use a lot instead of subclassing. Check wwdc protocol oriented programming with swift