Why do I need to unwrap the variable unwrapped
in the final return statement? Isn't guard supposed to handle this?
func test() -> String {
let fmt = NSNumberFormatter()
let myValue:Double? = 9.50
guard let unwrapped = myValue else {
return ""
}
return fmt.stringFromNumber(unwrapped)
}
error: value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'? return fmt.stringFromNumber(unwrapped)