Objective-C Language Protocols Conforming to Protocols It is also possible for a class to conform to multiple protocols, by separating them with comma. Like when conforming to a single protocol, the class must implement each required method of each protocols, and each optional method you choose to implement.
Objective-C allows you to define protocols, which declare the methods expected to be used for a particular situation. This chapter describes the syntax to define a formal protocol, and explains how to mark a class interface as conforming to a protocol, which means that the class must implement the required methods.
According to the docs,
[MyClass conformsToProtocol:@protocol(MyProtocol)];
should work.
Or, in case it is a general pointer, like:
Class<MyProtocol> someClassPointer = nil;
you can use:
[someClassPointer.class conformsToProtocol:@protocol(MyProtocol)];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With