Closed IngwiePhoenix closed 8 years ago
Same as Obj-C ;)
if ([foo respondsToSelector:@selector(doActionWithString:)]) {
[foo performSelector:@selector(doActionWithString:) withObject:"Foo"];
}
performSelector:
performSelector:withObject:
performSelector:withObject:withObject:
Ohh, okay. I didn't see any public methods on oj
regarding performSelector
:). Thanks for the heads-up.
I also tested to see if variable strings work. method
is treated as the selector constant - disregarding the value it actually holds. So much for that. Again, thanks! :)
One can check for a method to exist like so:
But is there a way to run a method dynamically?
I see that ojc turns selectors into pseudo objects, for instance
where
{ respondsToSelector_: 1 }
is some kind of selector - at least, that much I understand.So is it actually possible to call methods dynamically?