Skip to content

Instantly share code, notes, and snippets.

@AmitaiB
Created November 17, 2016 04:41
Show Gist options
  • Save AmitaiB/095f73ee8e0325a96ff23b3f099cf61a to your computer and use it in GitHub Desktop.
Save AmitaiB/095f73ee8e0325a96ff23b3f099cf61a to your computer and use it in GitHub Desktop.
Swift 3 Logical XOR Operator
precedencegroup BooleanPrecedence { associativity: left }
infix operator ^^ : BooleanPrecedence
/**
Swift Logical XOR operator
```
true ^^ true // false
true ^^ false // true
false ^^ true // true
false ^^ false // false
```
- parameter lhs: First value.
- parameter rhs: Second value.
*/
func ^^(lhs: Bool, rhs: Bool) -> Bool {
return lhs != rhs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment