Don't make more versions of your source code. Rather than add more code bases, fix the underlying design problem that is preventing you from running from a single code base. From Extreme Programming Explained
For a app developer, usually we had to modify our app for specific targets and markets, different login paths, alternative functions, various layouts, etc.
It's ok to have a helper function to check locales for us, but what if we had to separate our source code into two apps, just like Evernote and 印象筆記 (Evernote for China market) .
Different bundle ids, backend servers, might even icons!
Create a new Build Configuration set:
In project's build settings , find preprocessor marcros column, you can define different values for each of your configurations. You can define KEY=VALUE or just KEY macros here.
In your code, you can implement preprocessor marcos like this:
#ifdef foo // somethings #else // some other things #endif Go to your project's build settings , select Editor -> Add Build Setting -> Add User-Defined Settings.
You will get a User Defined field. For my usage, I create two values named APP_NAME and BUNDLE_ID .
In my -info.plist , I changed my Bundle display name and Bundle identifier value to ${APP_NAME} and ${BUNDLE_ID} .
I use Asset Catalog handling my image resources, inside Images.xcassets create a new App icon set.
Back to your target build settings , you can find Asset Catalog App Icon Set Name field, specify which App icon set shuld be used for configurations.
That's it.
From Scheme editor , select which build configurations you want to apply.
If you run Continuous integration for your project, you must build your project with xcodebuild or xctool , they both had -configuration flag, specify your build configuration name to it.