I have a typedef enum I use to represent a state of a job in a queueing system and it is defined as
typedef enum {
kTWjobStateRunning,
kTWjobStateQueued,
kTWjobStateError
}TWjobState;
Everything is fine, but now I would like to store it as an attribute in CoreData. My first idea is that an enum is basically an integer, so would wrapping the TWjobState
in a NSNumber
work? Do I have to use casts to persuade the compiler?
Best practice question
I saw this use of enums often in Cocoa and Foundation classes and also the use of bitmasks. Is there a more modern, more object-oriented way to achieve the same?
Thanks for your help.