Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Divide an app to multiple apps that have different UI design and share logic code

I have an app which I will call it the "base app". The app works with many brands. I need now to separate those brands, and to make a distinct app for every brand. Every app will have a slightly different design (including different images) and here and there maybe some specific-to-a-brand code. All of the apps should also use the same base code from the "base app" that deals with logic.

I have some options I have thought, but I am not sure if any of them suit my needs. Will be happy for clarifying the difference among the options.

The options I have thought are:

1) Creating an app for each one of the brands and just copy-paste the class files from the "base app" as a reference, except the .xib files, which will be copied as a copy. The problem is that then I do not know how and where to write a brand specific code (because it will be shared among others).

2) Creating a workspace that will include the projects for each one of the brand. Not sure how this works and if this is correct, will be glad for help clarifying here.

3) Nest a "base app" project inside every brand's project. Any help clarifying what does it do will be appreciated.

3) Using the base app as a static library which will be linked in every brand's project. Not sure what will happen with the UI (shared, not shared). Will be glad for help clarifying here too.

4) Using a simple way of maintaining each one of the brand's project, including the shared code (which will be a disaster, I guess).

like image 981
user-123 Avatar asked Nov 05 '13 08:11

user-123


1 Answers

The simple solution in iOS is use targets.

For resources you can use different targets for each brand and then select different resources (images, xibs, etc) for each target.

Also if the changes in code are minimal you can then refactor some part of your code and create different classes with different implementation for each target (you can use some pattern like a Factory). Also you can simply use preprocessor macros.

It's not the better, but this is the simplest and quick approach, but if your code changes a lot it's better to create a core library like the other answers say.

like image 158
alejandromp Avatar answered Sep 28 '22 01:09

alejandromp