Tag: string interpolation

Swift 3不正确的string插值隐式解包选项

为什么在Swift 3中使用string插值时隐式解包的选项不会被解开? 示例 :在操场中运行以下代码 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") 当然,我可以使用+运算符连接string,但是在我的应用程序中,我几乎在任何地方都使用string插值,现在由于这个(bug?)而不再工作了。 这甚至是一个错误,或者他们故意用Swift 3改变这种行为?