Static library conflict when used across multiple feature targets

Question or problem

I’m working on a modular iOS application using Tuist, where each feature is defined as a separate module (target). Some features depend on the same external SPM dependencies (e.g., Moya, Alamofire, TCA, etc.).

When I try to build the main app target that includes multiple features, I receive runtime warnings and potential crashes due to the same static libraries being linked from multiple modules:

Target 'Alamofire' has been linked from target 'FeatureOne' and target 'FeatureTwo', it is a static product so may introduce unwanted side effects.

Expectation

A way to solve the problem with static linking

Context

  • Tuist version: 4.50.1
  • SwiftPM dependencies
  • Each feature is a separate Target, and each is importing a common set of dependencies (e.g., Moya, TCA, etc.)
  • The main app target depends on multiple feature targets

Reproduction (mandatory for problems)

  1. Create a Tuist project with the following structure:
App/
  ├── Features/
  │    ├── FeatureOne/
  │    └── FeatureTwo/
  1. Let both FeatureOne and FeatureTwo link to the same SPM dependencies (e.g., Moya, Alamofire, etc.)
  2. Let the main App target depend on both features
  3. Build and run — runtime warnings

Hey :wave:

What to do here very much depends on your needs and there’s no silver bullet. I’d suggest giving this a read: Dependencies · Projects · Develop · Guides · Tuist.

You may also find this post useful: Implicit dependencies declaration - #2 by pepicrft