Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a @() in objective-c means?

Tags:

objective-c

I've seen @(NO) in objective-c code, I guess it's a kind of syntactic sugar, but what does it actually mean?

like image 966
Leo Avatar asked Sep 01 '15 11:09

Leo


People also ask

What does the symbol mean in Objective-C?

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.

What does @class mean in Objective-C?

@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.

What does @dynamic do in Objective-C?

@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).

What does super mean in Objective-C?

Super is self , but when used in a message expression, it means "look for an implementation starting with the superclass's method table."


1 Answers

@(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

like image 169
Pawan Rai Avatar answered Sep 25 '22 03:09

Pawan Rai