In Swift, I can do:
#if DEBUG
// code
#else
// code
#endif
but making custom macros as described in #ifdef replacement in the Swift language answers doesn't work for me.
How am I supposed to do this for Swift 5 / Xcode 12?
Edit: My problem was that I assumed testing an application would trigger the macros in the application if I defined them in the AppTest target.
Putting -DYOURMACRO
in Other Swift Flags under Swift Compiler - Custom Flags does indeed work.
The way to do what I wanted is either to put this flag in the application target whenever I want to run unit tests (really don't like this solution), or using launch arguments instead (not optimal but will do).