I want to use an Optional variable with the ternary conditional operator but it is throwing error this error: optional cannot be used as boolean. What am I doing wrong?
This even works well if the value you want is a property or result of a function call on an optional (in Swift 3.0):
return peripheral?.connected ?? false