Skip to content

Instantly share code, notes, and snippets.

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 DivineDominion/12b96f625cb640dd88d4f0ebdf5f59fe to your computer and use it in GitHub Desktop.
Save DivineDominion/12b96f625cb640dd88d4f0ebdf5f59fe to your computer and use it in GitHub Desktop.
struct Foo: ExpressibleByBooleanLiteral {
var value: Bool
init(booleanLiteral value: BooleanLiteralType) {
self.value = value
}
}
func ==(lhs: Foo, rhs: Foo) -> Bool {
return lhs.value == rhs.value
}
let x = Foo(booleanLiteral: true)
if x == true {
print("true")
} else {
print("false")
}
@DivineDominion
Copy link
Author

prints "true" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment