In Objective-C 2.0 I am assigning a value to an NSNumber property:
myObject.myProperty = 5;
The compiler tells me:
Implicit conversion of 'int' to 'NSNumber *' is disallowed with ARC
So I thought, what happens if I do this:
myObject.myProperty = @5;
Inspecting the property in the debugger shows:
_myProperty = (__NSCFNumber *) (int)5
This makes the compiler happy and nothing bad seems to happen, but I don't really understand what's happening.
What exactly does this shorthand do, and is it safe? What is NSCFNumber? I don't see it in the docs.