LoginSignup
10

More than 5 years have passed since last update.

Releaseビルド時にprintによる出力を止める方法

Posted at

Debugビルド時に出力していたprintによるログは、Releaseビルド時には垂れ流したくない...

import UIKit

func print(_ items: Any..., separator: String = " ", terminator: String = "\n") {
    #if DEBUG
        let output = items.map { "\($0)" }.joined(separator: separator)
        Swift.print(output, terminator: terminator)
    #endif
}

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    // ...省略...
}

これでOK!

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10