Multiple apps from one code base - multiple projects or targets in Xcode?

I would suggest you a hybrid approach depends on your needs

  • If you need several applications - create Target, that is exactly what they are for. You can handle sharing files using Target Membership[About]

  • If you have source code which can be separated into module - create additional Project (for shared source) inside Workspace. This technic is used by CocoaPods

[Xcode Workspace vs Project]
[Xcode components]


I think you have at least 3 options here:

  1. Separate projects. It is more difficult to share code across projects, but with Xcode workspaces this is quite feasible. If you have a lot of customization for each project, this might make sense.

  2. Same project, more targets. This is the usual way this is done. It is very easy because you have a very neat overview of what files go into which target. If you have around, say, a dozen or so targets, it is really quite easy to handle.

  3. Separate git branches. I have worked with this in the past. The differences between the apps (Info.plist, configuration files, data files) are just swapped in the corresponding git branch. This is practical if you have a lot of data and don't need to have all of it available at all times. However, the complexity of git is considerable if you are not familiar with it. You can create git submodules to change the shared code parts in one go.

Tags:

Ios

Xcode