When I want to check if an Optional Bool is true, doing this doesn\'t work:
var boolean : Bool? = false
if boolean{
}
It results in this error:
I found another solution, overloading the Boolean operators. For example:
public func < (left: T?, right: T) -> Bool {
if let left = left {
return left < right
}
return false
}
This may not be totally in the "spirit" of the language changes, but it allows for safe unwrapping of optionals, and it is usable for conditionals anywhere, including while loops.