Skip to content

Instantly share code, notes, and snippets.

@foxicode
Created October 15, 2020 20:17
Show Gist options
  • Select an option

  • Save foxicode/9b13826ee414079bdf3140aa3fb35056 to your computer and use it in GitHub Desktop.

Select an option

Save foxicode/9b13826ee414079bdf3140aa3fb35056 to your computer and use it in GitHub Desktop.
Swift Bool conversions
import Foundation
let b1 = Bool("1") // nil
let b0 = Bool("0") // nil
let bYes = Bool("YES") // nil
let bNo = Bool("NO") // nil
let bTrue = Bool("true") // true
let bFalse = Bool("false") // false
print(true) // "true\n"
print(false) // "false\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment