How to properly set iOS deployment target for all generated targets (from Swift Packages) in Tuist?

Hello :wave:
How to properly set iOS deployment target for all generated targets (from Swift Packages) in Tuist?

I’m trying to set a consistent deployment target across all my generated targets. Currently, I have this configuration in my Package.swift:

let packageSettings = PackageSettings(
    baseSettings: .settings(
        base: [
            "IPHONEOS_DEPLOYMENT_TARGET": "16.0",
            "SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD": "NO",
            "SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD": "NO",
        ],
        configurations: projectConfigurations
    )
)

However, this IPHONEOS_DEPLOYMENT_TARGET setting doesn’t seem to be applied to the generated targets. The targets in my project are not inheriting this deployment target setting.
Is it possible to do this with PackageSettings?

Expectation

I was expecting this base setting to apply to all the generated targets. It would not be scalable for me to enumerate this in the target settings for all of them.

Context

  • Tuist version: 4.52.2

Hey :wave:

baseSettings are set at the project level – but if dependencies explicitly declare their OS deployment targets, those get written at the target level and have precedence.

I would be curious what is the need to override the deployment target of the dependencies? Setting the deployment target downstream in your internal targets should be generally enough – and overriding those values is not possible in the default SwiftPM Xcode integration.

During mapping we convert SPM packages to tuist Target types and they go through the same generation process as natively defined Targets.

Specifically this method in code applies the target derived settings (like deployment target) at the end which overrides settings that would be set in Package.swift with PackageSettings

@omkar.sabade

These aren’t all external packages - some are local SPMs that I’m actively developing within the same workspace. Since I’m working on these local packages alongside my main app, I want to maintain consistent deployment targets across the entire codebase to avoid build issues and ensure I can use the same iOS APIs throughout.

Then you should be able to define the deployment target in the local Package.swift manifests. I don’t think the PackageSettings is a good entrypoint to this. Alternatively, I would suggest migrating those local packages into regular Tuist targets instead – unless those local packages are depended upon from other repositories.

Thank you both, for the response.

Alternatively, I would suggest migrating those local packages into regular Tuist targets instead – unless those local packages are depended upon from other repositories.

Unrelated, but do I miss out on any tuist features if I have them as swift packages?

Yes, such as easily sharing definitions for your modules via ProjectDescriptionHelpers which you would be able to use to have a consistent deployment targets across your internal modules instead of having to repeat that in each individual Package.swift.

And since Tuist converts Package.swift into Tuist targets, you’re adding a possibly unnecessary indirection in the generation process that can be sometimes confusing.