views:

1963

answers:

2

Well, for integers I would use NSNumber. But YES and NO aren't objects, I guess. A.f.a.i.k. I can only add objects to an NSDictionary, right?

I couldn't find any wrapper class for booleans. Is there any?

+10  A: 

You use NSNumber.

It has init... and number... methods that take booleans, just as it does integers and so on.

From the NSNumber class reference:

Creates and returns an NSNumber object containing a given value, treating it as a BOOL.
+ (NSNumber *)numberWithBool:(BOOL)value

and:

Returns an NSNumber object initialized to contain a given value, treated as a BOOL.
- (id)initWithBool:(BOOL)value

and:

Returns the receiver’s value as a BOOL.
- (BOOL)boolValue
harms
Great! I guess internally it stores the bool as 0 / 1?
Thanks
A: 

Thanks a lot harms. THis is helpful.