LoginSignup
1
0

More than 5 years have passed since last update.

Swiftで開発をする上で(備忘録)

Last updated at Posted at 2016-10-28

開発においての一つの方法

・Storyboardは画面遷移を定義するためだけに使う

・各コントローラーのUI構成は、xibで作る

・画面の遷移処理はperformSegueWithIDでやる

・delegate callback notificationの使い分け

リリース時でのログの排除

デバック時のみログを出力し、リリース時にはログを出さないようにするには、

// リリースビルドでprint, debugPrintを無効化

func print(object: Any) {
    #if DEBUG
        Swift.print(object, terminator: "")
    #endif
}

func debugPrint(object: Any) {
    #if DEBUG
        Swift.debugPrint(object, terminator: "")
    #endif
}

// リリースビルドでNSLog無効化
func NSLog(message:String){
    #if DEBUG
        Foundation.NSLog(message)
    #endif
}
func NSLog(format:String, _ args:CVarArgType...){
    #if DEBUG
        Foundation.NSLog(String(format: format, arguments: args))
    #endif
}
1
0
0

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
1
0