3

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?

kbpontius
  • 3,867
  • 1
  • 30
  • 34
  • Did you do "Swift Compiler - Custom Flags" -> "Other Swift Flags" -> `-D DEBUG`? – Aaron Brager Jul 15 '15 at 22:24
  • Wow, that did the job! It seems counterintuitive to have multiple areas where you can set DEBUG mode. Do you have Apple Documentation that you could post along with your comment in an answer? I'll select it if you would. @AaronBrager – kbpontius Jul 15 '15 at 22:31

1 Answers1

5

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.

Community
  • 1
  • 1
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
  • Thanks @AaronBrager. Here's another helpful post: http://stackoverflow.com/questions/24111854/in-absence-of-preprocessor-macros-is-there-a-way-to-define-practical-scheme-spe – kbpontius Jul 15 '15 at 23:07
  • Guys I can't find the "swift compiler - custom flags" things, where is it located? –  Dec 01 '15 at 14:13
  • Ok found it in the project options! Thanks guys –  Dec 01 '15 at 14:19