How to convert and compare NSNumber to BOOL?
You currently compare two pointers. Use NSNumber
s methods instead to actually compare the two:
if([someNSNumberValue isEqualToNumber:[NSNumber numberWithBool:NO]]) {
// ...
}
To get the bool value from a NSNumber
use -(BOOL)boolValue
:
BOOL b = [num boolValue];
With that the comparison would be easier to read for me this way:
if([num boolValue] == NO) {
// ...
}
Swift 4:
let newBoolValue = nsNumberValue.boolValue