How to solve “String interpolation produces a debug description for an optional value; did you mean to make this explicit?” in Xcode 8.3 beta?

后端 未结 8 1197
失恋的感觉
失恋的感觉 2020-12-12 19:04

Since beta 8.3, zillions warnings \"String interpolation produces a debug description for an optional value; did you mean to make this explicit?\" appeared in my code.

8条回答
  •  借酒劲吻你
    2020-12-12 19:16

    Create an interpolation method that accepts an optional generic Type with an unnamed parameter. All your annoying warnings will magically disappear.

    extension DefaultStringInterpolation {
      mutating func appendInterpolation(_ optional: T?) {
        appendInterpolation(String(describing: optional))
      }
    }
    

提交回复
热议问题