Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Debug Scheme

Tags:

xcode

swift

I have debug scheme set up and the DEBUG flag set to 1 on my preprocessor macros, but when I set up something like this:

func print(_ object: Any) {
#if DEBUG
    Swift.print(object)
#endif

}

it is not printing even in debug mode. How would I go about correcting this behavior?

like image 802
daredevil1234 Avatar asked Aug 31 '25 06:08

daredevil1234


1 Answers

Go to Build Settings and add -D DEBUG to Other Swift Flags.

Other Swift flags

Then this will work properly:

#if DEBUG
    print("This is DEBUG")
#else
    print("This is not DEBUG")
#endif
like image 91
Code Different Avatar answered Sep 02 '25 21:09

Code Different