bursyllac bursyllac - 3 months ago 5x
iOS Question

Can I use an enum as a property in Objective C

I saw it is customed to use a boolean property as a flag. something like that:

@property (nonatomic) BOOL commaAlreadyIntroduced;

I need something like that but with at least 3 or 4 states.

Can I use an enum?

The standalone enum should look like:

typedef enum stackState{
empty, oneOperand, operandAndOperator, fullStack


Yes, it's not a problem:

@property (nonatomic, assign) stackState yourIvar;