I have declared one variable as NSNumber
and assigned bool true
. Then I have declared another NSNumber
and assigned int 1.
When I try to retrieve the datatype of both variables, both returns as Int. This issue happened only in iPhone 5 and lower which is 32bit architecture.
How to resolve this issue?
var number: NSNumber = 1
var boolienValue: NSNumber = true
func getType(value: AnyObject) -> String? {
if value is Int {
return "Int"
} else if value is Bool {
return = "Bool"
}
else if value is Double {
return = "Double"
}
return nil
}