Objective-C Runtime: best way to check if class conforms to protocol?

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)];