Xcode 8.2 和 Swift 3 发布应用时是否还需要 hide/remove 打印语句?

Do we still need to hide/remove print statements in Xcode 8.2 and Swift 3 when releasing app?

发布带有 Xcode 8.2 和 Swift 3 的应用程序时,是否仍然建议/需要隐藏打印语句?

目前我有一个像这样的全局打印功能

 func print(_ items: Any...) {
    #if DEBUG
        Swift.print(items[0])
    #endif
}

仅当项目处于调试模式时才会打印。

Apple 最近终于在 Xcode 中默认添加了 DEBUG 标志,因此我们不必再在 Build Settings 的 OtherFlags 中手动添加它。

这让我想知道我们是否真的还需要删除 print 语句,或者 Swift/Xcode 是否自动删除,或者是否有一些其他不再需要的优化。

如果不是上面的方法是最好的方法吗?

经过更多研究后,我们似乎 need/should 隐藏了要发布的打印语句。正如我的问题中提到的,最好通过全局打印功能

func print(_ items: Any...) {
    #if DEBUG
        Swift.print(items[0])
    #endif
}
import Foundation

class print {
   @discardableResult init(_ Item: Any) {
        print(Item)
    }

   private func print(_ item: Any) {
    #if DEBUG
        Swift.print("HI + \(item)")
    #endif
    }
}

-> 打开构建设置 -> Swift 编译器自定义标志 -> 其他 swift 标志。 -> 展开 Other swift 标志 -> 在调试之前添加 -D DEBUG。 创建新的 class name print 并添加代码。它将绕过指纹。