3 ms·
Method selectors in Obj-C don't have to be strings, as long as you can turn a string into one occasionally. You do still need to do a hash lookup to get the me
by astrange 11y ago
Method selectors in Obj-C don't have to be strings, as long as you can turn a string into one occasionally.
You do still need to do a hash lookup to get the method implementation, since the selector table changes at runtime and objects have to safely respond to unhandled selectors and all that.
- fleitz 11y agoI meant string as in char* not NSString, selectors specifically the SEL datatype are strings They certainly don't have to be, however, they are. SEL selector = @selector(applicationDidBecomeActive:); printf("%s",(char*)(void*)selector); // Prints applicationDidBecomeActive: