Search code examples
androidiosgitproject

Similar apps with similar code and one project


Hi and first of all thanks in advance, i have a question related with project structure.

Imagine the following situation: we have 4 apps with mainly the same functionality. Let's call them A, B, C and D. Everyone is build natively in Swift/Objective-C. We can assume that almost 85% of the code is the same between A, B, C and D. The same for resources but probably with a lower percentage.

What I have now is one git project with with at least 4 branches (one for each of the apps). When I develop a new feature in app A, I use git checkout --patch A <filename> to bring the changes I'm interested to the other apps. The process is slow since i have to do the same 3 things to bring changes to all the other 3 branches. Imagine that Swift version inside the app is upgraded and almost all the files need to be updated... It would be better than to do the same 4 times, but still slow.

Is there an optimal to way to handle this? In iOS, since the package name is not related with the name of the folders where code files are located, this is indeed an option (slow, but an option), but how to achieve this in Android? The same Activity with almost the same code is located in two different paths (com.company.A.Activiy and com.company.B.Activiy) between branch A and B, so checkout --patch does not work. Any solutions? Any optimal way?

Thanks in advance!!!


Solution

  • For that scenario, I would extract out the core of the application, which would be identical for all of the projects into it's own library project, then reference that library in each of the 4 projects. Any changes in that library simply requires a recompile in the 4 UI projects.