We can easily check if object has a method by using respondsToSelector:
, but how we do it for static functions in class?
I would like to have something like this:
if ([cls classRespondsToSelector:@selector(staticMethodName)]) {
...
}
In Objective-C classes are objects too.
if ([[myClass class] respondsToSelector:@selector(classMethod)]) {
}
Also a small note, these are NOT 'static' methods. That means something specific which doesn't exist in Objective-C. They are class methods.
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