I would like to implement configs dependent on environment in my iOS project and I'm thinking how should I do this. Things to cover that come to my mind:
- Some consts that I use in my classes - I'm using some in development and other on production.
- Additional Info.plist key in development (so HTTP urls could work), don't want this on production
I wouldn't want to change it every time I deploy to production.
So I found two ways:
Where to set environmental variables in iOS? But it's an old thread and kinda non-friendly.
https://collectiveidea.com/blog/archives/2014/10/01/simple-cocoa-configuration-using-swift-structures Which looks very clean to use inside the code project but I think it's not possible to implement this inside Info.plist, or is it? And is it possible to include struct dev extension file only in development environment (so it won't load on production)? I would like to have it in the git repository so I don't have to manually send it to other developers.
Also, where should I put the "environment switch"? Is there some fancy way to place it inside the project (but in the way that does not affect production) or I have to add add it to "Edit scheme > environment variables"?
Would appreciate any help with that :)