Last active
October 9, 2020 20:31
-
-
Save samuelematias/887d15f08079d6d9127308a8ba7412f1 to your computer and use it in GitHub Desktop.
How handle bool values coming as NSNumber. More about: https://en.it1352.com/article/6f2bc8b44b4846bb80e09201f4acb25e.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isBoolNumber(_ num: NSNumber) -> Bool { | |
let boolID = CFBooleanGetTypeID() // the type ID of CFBoolean | |
let numID = CFGetTypeID(num) // the type ID of num | |
return numID == boolID | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment