Is there a correct way to determine that an NSNumber is derived from a Bool using Swift?
An NSNumber containing a Bool is easily confused with other types that can be wrapped in the NSNumber class: NSNumber(bool:true).boolValue // true NSNumber(integer: 1).boolValue // true NSNumber(integer: 1) as? Bool // true NSNumber(bool:true) as? Int // 1 NSNumber(bool:true).isEqualToNumber(1) // true NSNumber(integer: 1).isEqualToNumber(true) // true However, information about its original type is retained, as we can see here: NSNumber(bool:true).objCType.memory == 99 // true NSNumber(bool:true).dynamicType.className() == "__NSCFBoolean" // true NSNumber(bool:true).isEqualToValue(true) ||