Skip to content

How to define custom flags for the testing environment

Nathan Kot edited this page Aug 6, 2015 · 2 revisions

First, you'll need to create a new build configuration by clicking on your Project Name in the file navigator, and switch to the Info tab. Under Configurations click on the + icon and make a duplicate of your Debug build configuration and name it Testing.

Sreenshot

Next, go to the Build Settings tab and under Swift Compiler - Custom Flags add the TESTING flag to the Testing build configuration.

Screenshot

Now edit your Schemeand under Test change the build configuration to Testing.

Screenshot

Finally, do pod install again. You might get a warning CocoaPods did not set the base configuration of your project because ... which you can ignore and is related to this issue.

Now you should be able to use the TESTING preprocessor macro!

Clone this wiki locally