Remove println() for release version iOS Swift

前端 未结 19 1521
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 15:55

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

19条回答
  •  感动是毒
    2020-11-29 16:33

    This works for me (add this as a global function in the project)

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

提交回复
热议问题