So I have an issue with using a constant variable in the following switch statement in Objective-C.
I have Constants.h with the following:
I would normally follow what Apple seem to do and define a typedef enum in the .h file like this.
typedef NS_ENUM(NSInteger, PSOption) {
PSOption1,
PSOption2,
PSOption3,
PSOption4,
};
You can then use it in your case statement and even pass it into functions as well as a type e.g.
- (void)myMethod:(PSOption)option;
A further advantage of doing this over a #define is code completion and compiler checking