This is a little new for me. What's the best way to implement this? I'm not sure if there's any trouble with this approach. It seems to work so far.
Code:
enum
{
MyObjectChecked = 1 << 0
};
@interface MyObject : NSObject
{
uint8_t myFlags;
}
- (BOOL)isChecked;
- (void)setChecked:(BOOL)checked;
@end
@implementation MyObject
- (BOOL)isChecked
{
BOOL checked = (myFlags & MyObjectChecked);
return checked;
}
- (void)setChecked:(BOOL)checked
{
if (checked)
{
myFlags |= MyObjectChecked;
}
else
{
myFlags &= ~MyObjectChecked;
}
}
@end