Setting Swift compiler flags in CocoaPods | iOS & macOS development | Scoop.it

Lately I've been working on a Swift framework that I'm integrating into an existing app with CocoaPods. The framework relies on an #if DEBUG macro to run one of two code paths, depending on whether we're building with the Debug configuration or something else.


In order for our code to trigger an #if <something> macro, we need to set a -D<something> flag in the other Swift flags section of our target's build settings. There's nothing special about "debug" as it's used here, we're just creating a global variable and naming it DEBUG.