I've seen @(NO)
in objective-c code, I guess it's a kind of syntactic sugar, but what does it actually mean?
That symbol is used to declare block. For more information read here Blocks Programming Topics. Some more info: Block objects are a C-level syntactic and runtime feature.
@class is used for creating forward declaration of any class. If you're creating any class that's implementation is unknown to you then you can do this using @class compiler directive. You can implement this class when the implementation is known to you.
@dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass or will be provided at runtime).
Super is self , but when used in a message expression, it means "look for an implementation starting with the superclass's method table."
@(expression)
Dynamically evaluates the boxed expression and returns the appropriate object literal based on its value (i.e. NSString for const char*, NSNumber for int, etc.). This is also the designated way to use number literals with enum values.
compiler-directives
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