I have a protocol defined:
protocol Usable {
func use()
}
and a class that conforms to that protocol
class Thing: Usabl
You are getting
Bound value in a conditional binding must be of Optional Type
because thing as Usable must return an optional type so making it as? should solved the problem. Unfortunately, the error still persisted for some odd reason. Anyway, a workaround I found to get it to work is to extract out the variable assignment inside the if statement
let thing = Thing()
let usableThing = thing as? Usable
if useableThing {
usableThing!.use()
}
else {
println("can't use that")
}