Targets vs Library

Over the long term I plan on making several games for iOS using a lot of common functionality. I am trying to plan for the future about how I will share all of that code between my games.

As I understand it I basically have two options:

  1. Create a single Xcode project with a different Target for each game.
  2. Create a common Library and a different Xcode project for each game.

Does anyone have any feelings on the pros/cons for these two approaches (or a 3rd approach that is better)?

I assume your games will be pretty different (you will not pass the review otherwise).

So 1st option will create a pretty complex project, with many different storyboards, many different classes, all mixed in a single project.

That may end difficult to use and maintain.

The 2nd option seems clearer: you isolate common functions in libraries and use them as needed, exactly as you do when you import an API Kit.

For option 2...

...you could consider using Swift Package Manager, to make a number of separate self-contained modules.
Each App would be it's own Xcode project, and could include whichever Swift Packages it requires.

Of course, you could use a single Swift Package, for all the shared code.
But I would lean towards using a number of packages, each with a clearly-defined purpose.

I find the modular approach cleaner, and easier to maintain.

Targets vs Library
 
 
Q