Skip to content

Instantly share code, notes, and snippets.

@samuelematias
Last active October 9, 2020 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelematias/887d15f08079d6d9127308a8ba7412f1 to your computer and use it in GitHub Desktop.
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
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