最佳答案
为什么在 Swift 3中使用字符串插值时 隐式打开的可选项没有展开?
例子 : 在操场上运行以下代码
var str: String!
str = "Hello"
print("The following should not be printed as an optional: \(str)")
产生这样的输出:
The following should not be printed as an optional: Optional("Hello")
Of course I can concatenate strings with the +
operator but I'm using string interpolation pretty much everywhere in my app which now doesn't work anymore due to this (bug?).
这究竟是一个错误,还是他们故意用 Swift 3改变了这种行为?