Since there is new NSNumber
literals in Objective-C that you can use, for instance:
NSNumber *n1 = @1000; // [NSNumber numberWithInt:1000]
But it doesn't seem to be possible to use together with enums? I have tried:
typedef enum {
MyEnumA = 0,
MyEnumB,
MyEnumC
} MyEnum;
NSNumber *n2 = @MyEnumA; // [NSNumber numberWithInt:MyEnumA]
But I get a compiler error saying:
Unexpected '@' in program
I don't understand why it doesn't work since an enum is an int? Is there a way to make this work?
@MyEnumA
later, and don't want to break your code. – Tasker