Search code examples
iosobjective-cpropertiesnsarray

BOOL array in Objective-C


How can I declare an array of BOOL as a property in an Objective-C class? This is not correct:

@property (nonatomic) NSArray<BOOL> *checked;

Solution

  • You should use NSNumber and init them with: - (NSNumber *)initWithBool:(BOOL)value;. So the property should look like this:

    @property (nonatomic) NSArray<NSNumber *> *checked;