-2

I have searched the internet for an answer but can't really find what I am looking for. Im looking to have a master code base that I can use across lots of apps. The only differences are the app Icon, a background image, app name and a url to a server for all the information. Currently I have a master copy of the app both on ios and android, and im just copying it (so creating a new project with the same code), then changing the little bits that need changing. So in doing this if I updated the master app with a new feature I then have to add the new bit of code to every project then update them. Is there a way I can just update the master code and it will update all of my projects apart from the url, name and images.

Edit - I have looked at that question (android-flavors-with-different-base-themes but im not taking about making 10 or so apps from one code base. We currently have 170+ apps and growing. Is it accpetable to have that many android flavours or xcode targets in one project and would it be easy to add new ones.

As elrain has said below creating a library that I can import into each project is proberly going to be the best solution for my situation as I can manage the library and it will then update in all my projects. Im was just wondering if anyone has encountered this problem before.

Thanks

Community
  • 1
  • 1
Luke Chase
  • 322
  • 1
  • 18
  • Possible duplicate of [Android flavors with different base themes](http://stackoverflow.com/questions/34068870/android-flavors-with-different-base-themes) – R. Zagórski Nov 17 '16 at 14:46
  • Quite generic issue. use Xcode Targets for iOS and gradle flavors for Android – Nimble Nov 17 '16 at 14:47
  • The duplicate mentioned above only addresses part of the user's question. – picciano Nov 17 '16 at 14:48
  • Make a repo and let all your projects be a branch of that repo. And when commiting and fetching ignore the `resource` folder – Aidin Nov 17 '16 at 14:50
  • Do you need an SDK? This sounds like it could be done with a Library. An SDK is usually designed for others to develop on top of, yours seems like you want everything to stay the same minus a few simple changes which seems Library-esque to me. – zgc7009 Nov 17 '16 at 15:06
  • Yes sorry you are right I did mean library not SDK. – Luke Chase Nov 17 '16 at 15:08
  • Just as a heads up I don't think there is a restriction to the number of flavors gradle will allow you to have and you can completely manage this in a single project _if_ you want to. Heck, you could even create the library and mange it under a single flavor to reduce assets and then after you compile the library create another project that incorporates the library and the assets into specific gradle flavors. – zgc7009 Nov 17 '16 at 20:28

6 Answers6

0

(For iOS) Given the limited changes from one app to another, I would suggest creating additional build targets within the same Xcode project. You can duplicate the existing target, then make changes to it by determine which resource and classes belong to a given target.

picciano
  • 22,341
  • 9
  • 69
  • 82
  • Hello picciano. I have looked at this but I currently have 170+ apps and growing. Is it really the best option to have that many different targets in one xcode project? I think my best option would be to create a library of some sort that could be imported into every project. – Luke Chase Nov 17 '16 at 15:01
0

From my point of view, you could create a SDK from master code and use that SDK in your other projects.

elrain
  • 9
  • 1
  • Hello elrain, I have looked into this and think it is going to be the best answer for my situation. Have you found any guides/tutorials on how to do this? – Luke Chase Nov 17 '16 at 15:01
  • For android look through this guide [this guide](https://developer.android.com/studio/projects/android-library.html). – elrain Nov 17 '16 at 15:40
0

This answer is a bit abstract, you can try to use the clean architecture, this archtiecture has a very useful feature for your case which is creating core elements or classes that can be shared between applications for the same business logic, there are many iOS archtiectures based on clean, you can eiher understand the big picture of clean and apply it by yourself, or you can understand specfic iOS implementations, probably the most famous one is VIPER , maybe not the answer you are looking for but i thought it is worth a shot.

0

You must use a code repository like gitlab and its features to commit and push your changes once and pull it in other projects many time

Saeed Zhiany
  • 2,051
  • 9
  • 30
  • 41
0

I had to do this and I created a library that was used used in all the projects, then just changed the bits of code I needed to.

0

I created a library that I then used for all my projects. It works well and recommend doing something similar.