Using the DEBUG configuration, I can switch behaviour on and off using this type of syntax:
#if DEBUG
Console.WriteLine("Debug");
#else
Console.WriteLine("Not Debug");
#endif
However, if I set up a different configuration, say: TEST then this doesn't work:
#if TEST
Console.WriteLine("Test");
#else
Console.WriteLine("Not Test");
#endif
Is there a way to check these?
Adding a Configuration Fire up Xcode and create a new project by choosing the Single View App template from the iOS > Application section. Name the project Configurations, set Language to Swift, and make sure the checkboxes at the bottom are unchecked. Tell Xcode where you'd like to store the project and click Create.
A build configuration is a collection of settings used to start a build and group the sequence of the builds in the UI. Examples of build configurations are distribution, integration tests, prepare release distribution, "nightly" build. A build configuration belongs to a project and contains builds.
A Debug configuration supports the debugging of an app, and a Release configuration builds a version of the app that can be deployed.
Yes you can use different configurations. DEBUG symbol is generated automatically if you choose Debug configuration in your configuration manager. You can check it. Go to Your project -> Properties -> Build -> Define DEBUG constant
If you need to use additional constant just enter your own in Conditional compilation symbols.
Steps for your case:
Run your code and enjoy :)
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