Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiler flags in a swift framework

Tags:

xcode

ios

swift

I'm developing a framework as a component to a project. The framework has some networking components and basically I want the path to change depending on the release configuration of the main app.

It's set-up as such:

let path = //development path

And id like to create a flag such that:

#if PRODUCTION
let path = //production path
#else 
let path = //dev path 
#endif

These release schemes are specific to the main app which has loaded the framework in. Is it still possible to use a compiler flag to define this behavior?

like image 363
wadda_wadda Avatar asked Dec 12 '25 21:12

wadda_wadda


1 Answers

you could create a global

var production: Bool!

in framework that should be set in an app using the framework

like image 116
Anton Tropashko Avatar answered Dec 15 '25 13:12

Anton Tropashko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!