Conforming to Protocols

suggest change

The following syntax indicates that a class adopts a protocol, using angle brackets.

@interface NewClass : NSObject <NewProtocol>
...
@end

This means that any instance of NewClass will respond to methods declared in its interface but also it will provide an implementation for all the required methods of NewProtocol.

It is also possible for a class to conform to multiple protocols, by separating them with commas.

@interface NewClass : NSObject <NewProtocol, AnotherProtocol, MyProtocol>
...
@end

As when conforming to a single protocol, the class must implement each required method of each protocol, and each optional method you choose to implement.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents