Selector Expressions (Cocoa)
The __selector
keyword can be used to get a selector reference on Cocoa, for example to dynamically invoke methods, or pass them to Cocoa APIs that expect a SEL
type.
SEL s = __selector(compare:options:);
Using the selector literal syntax will cause the compiler to check whether the specified selector is valid and known, and a warning will be emitted if a selector name is provided that does not match any method known to the compiler. This provides extra safety over using the NSSelectorFromString
function.
Cocoa Only
The __selector
keyword is relevant and available on the Cocoa platform only.
See Also
- Selectors
selector()
in Oxygene