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?
Go to Build Settings and add -D DEBUG
to Other Swift Flags.
Then this will work properly:
#if DEBUG
print("This is DEBUG")
#else
print("This is not DEBUG")
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With