Xcode Target Build Flavours

Question or problem

How to add remote Xcode Project as a dependency?

Explanation

I need to use so-called “flavours” (conditional compilation) for the final product. Here’s some explanation: link
The idea is to use custom EXCLUDED_SOURCE_FILE_NAMES setting in each Build Configuration (let me know if there’s another better approach).
This moves us back from using SPM (cause it does not support flavours)

Overall, in my example I have:

  • Main App project (runnable iOS app), which depends on:
    • Few local frameworks (each is an Xcode Project + Framework)
    • Few remote frameworks (each is an Xcode Project in separate Git remote repo).

Both local & remote framework can depend on another local/remote framework and/or 3rd party Swift Package.

To make everything work, I have to manually clone each local&remote framework in same parent folder, so then in Project.swift I can use a local dependency

Expectation

I’d expect a way to declare remote dependencies with support of different build configurations.

Context

  • Tuist version: 4.38.1

I checked Tuist Dependencies documentation - and seems only Swift Package manager-driven dependencies are supported. However, looks like this does not allow us to use custom build configurations.

PluginLocation

At the same time, there’s a pretty “PluginLocation” type of declaring dependencies, which supports raw git repo path & I think is close to what I need.

Reproduction (mandatory for problems)

Can prepare & attach an example by request (but it can be tricky because of need for demonstration remote dependencies)

Ok, I think I figured out how to achieve this. Recipe below (for anyone interested)

  1. Make each Remote framework an SPM package.
  2. Make each Local framework a Tuist-driven Xcode Project and Framework.
  3. And, main magic - use PackageSettings in Package.swift of main app, adding here custom settings and build configuration.

When Tuist generates the project, it uses those customized build settings and applies it to every Remote framework (which is still an SPM dependency).

Things shine even more if you use a custom Tuist Plugin, and reuse Settings/BuildConfiguration across multiple Remote frameworks and Main app.

Thanks Tuist team!