Leo
Leo

Reputation: 492

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

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

Upvotes: 7

Views: 3788

Answers (1)

Pawan Rai
Pawan Rai

Reputation: 3444

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

Upvotes: 11

Related Questions