I have my app's home screen as the following prototype : Considering this home screen, I have to develop the app in such a way that every feature among these four should be pluggable at build time. For example,
If I set a macro like
#define FEATURE_1 0
then, the home screen will have only 3 tiles for the remaining three features. Also, the files that are related to feature-1 should not get compiled in the resulting .ipa .
When i was developing these four modules, I have kept all the classes independent of each other. But the problem is I have a single storyboard which contains the whole UI. Now, I have to separate the UI and resources in such a way that if any of features is turned off, no files related to that feature should get compiled.
What i have tried : I read somewhere that making each feature as a static library would get my job done, however, I couldn't figure out how would I include/exclude a static library at build time. Also, it doesn't solve my problem of separating the views in the storyboard.
Specifically, the questions I have are :
1) How can I copy specific files to my project and leave out specific files depending upon the macro as a defined above? If it is possible, please direct me towards a good way of doing it.
2) How can I separate out the views on storyboard? May be define multiple storyboards and include the required ones at build time? Please guide.
Answer for 1 : You can't using only macros.
Create several targets for your different configurations, defines the macros you need on each target and toggle the file include checkbox to only include the needed files during the build.
Although you could use the build system, in your case it seems easier to you wrap the affected code in
#if FEATURE_1
...
#endif
For hiding the views you could use code in line of
#if !FEATURE_1
feature1View.hidden = YES;
#endif
depending what exactly you are trying to achieve.
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