Search code examples
iosswift2xcode7-beta3

Is Xcode 7 Debug Mode Working?


Using Xcode 7 Beta 3

The code below is failing to enter the #if DEBUG statement properly. I'm almost certain I'm in debug mode, but for some reason the following code isn't working:

#if DEBUG
    btnPrintPath.title! = "PrintPath"
#else
    btnPrintPath.title! = "" // EXECUTING THIS LINE.
#endif

My scheme looks like this: Build Scheme Configuration

I'm running the app with cmd + R.

Am I configuring this improperly?


Solution

  • Add -D DEBUG to "Swift Compiler - Custom Flags" -> "Other Swift Flags".

    There's no official documentation that mentions this feature (you might want to file a radar for that) but I saw it used in this related answer.