Search code examples
iosxcodeplistapplication-settings

How to change icon files with code constant on xCode?


I'm building an app that has a Free version and Paid version. The difference between the apps are only a define line of some constant in the code (it creates the code needed to add on each app).

I want the icons to change too according to this definition. Does someone knows how can I do that? can I choose for example between different info.plist files using code generated?

Please help.


Solution

  • You want to setup a duplicate Target of your main target for your lite version. In this secondary target, it should be identical except for a PREPROCESSOR MACRO that you add like LITE_VERSION. It should also point to a different info.plist

    Then, in the code at compile time, you can use #ifdef LITE_VERSION to compile Lite code vs Reg Code when you compile for that target.