所以我试着
let foo = dict["key"] as? String ?? "empty"
var bar = some_func(string: foo!)
and XCode 6 complains that
Operand of postfix '!' should have optional type; type is 'String'
on the second line.
如果我把第一行改成
let foo: String? = dict["key"] as? String ?? "empty"
错误消失了.
这是某种缺陷还是我做错了什么?