0

I have a set of utility classes that I reuse in several xcode projects.
I want to include the utility classes in every project. I currently do this by adding inside every xcode project a group and dropping there the files from the file system. This way, they are included in the compilation.

But every time I do filename changes in the utility classes (e.g. add/rename/delete a file) I have to go through all the projects and reflect the change there.

Some notes:

  • The projects are irrelevant, i.e. not different products from a suite of products. So I cannot use an all products project and do the separation at the targets level for each of the products.
  • When I do changes in a utility class from one of the projects, the changes should be reflected in all other projects.
  • the utility classes are already on a repo of their own.
  • I prefer not to make copies of the files of the utility classes inside every project
  • I do not want to do the trip of creating a framework that will then be used by every project. Not all classes are used by every project. I just want to have them compiled as a source files.

As a test, I made a project containing the utility classes and no target, added the project as a child of one of my projects. I.e. instead of having the yellow folder icon of the file group, I have a project icon containing the files.
The compilation does not seem to pick these files.

Maybe a cmakelists.txt file could serve this purpose? I.e. give to xcode an additional list of files to include in the compilation?

For the Windows's edition of my projects, I use Microsoft's Visual Studio "shared items" project which accomplishes exactly all these requirements.

What is your advice for xcode? Thanks!

Similar to:
Sharing classes between projects in xcode/objective-c
Sharing classes between Xcode projects

Mike
  • 436
  • 5
  • 9
  • Swift Package Manager handles this very gracefully, I highly recommend adopting it. See these two WWDC talks: [Adopting Swift Packages in Xcode](https://developer.apple.com/videos/play/wwdc2019/408/) and [Creating Swift Packages](https://developer.apple.com/videos/play/wwdc2019/410/). – Yonat Jan 06 '20 at 14:41
  • Thanks. Sorry, I forgot to mention that these classes are cross-platform C++ classes and have a few parts of the code in Obj-C. So, the Swift Package Manager is probably not applicable. – Mike Jan 06 '20 at 21:47

0 Answers0