Skip to content

Instantly share code, notes, and snippets.

@pauljohanneskraft
Last active June 9, 2016 18:58
Show Gist options
  • Save pauljohanneskraft/6a1a73d35d900d26ddb709e8173c50c8 to your computer and use it in GitHub Desktop.
Save pauljohanneskraft/6a1a73d35d900d26ddb709e8173c50c8 to your computer and use it in GitHub Desktop.
extension Bool : Comparable

Bool extensions

Comparable

extension Bool : Comparable {}
public func < (lhs: Bool, rhs: Bool) -> Bool {
return !lhs && rhs
}
func == (lhs: Bool, rhs: Bool) -> Bool {
return (lhs && rhs) || (!lhs && !rhs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment