I would like to globally ignore all println() calls in my Swift code if I am not in a Debug build. I can\'t find any robust step by step instructions for this a
Swift 4 Xcode 10.0
maybe you could use this
func dPrint(_ message: @autoclosure () -> Any) {
#if DEBUG
print(message())
#endif
}
The reason of using @autoclosure is that if you pass a function as the message parameter, the function will be called only in debug mode, it will cause a performance hit.
unlike the Swift.print(_ items: Any..., separator: String = default, terminator: String = default) function, my solution has only one parameter, because in most cases, we don't pass multiple parameters as the print function only shows information in console, we can just convert the parameters to String: "\(param1)"+"\(param2)", right?
hope u like my solution