What this thread does
Do first: inspect Package.platforms and the resolved dependency manifests, then choose each deployment floor before adding platform-conditional target dependencies.
Short answer
As of November 2026, current SwiftPM manifest docs require dependency deployment floors to be no higher than the consuming package's floor. Package target dependencies can be limited by platform (conditional dependencies). Use that API to restrict a dependency edge to supported platforms. (deployment contract).
Choose / don't choose
- Semantic version range: choose
.package(url:from:)for released dependencies whose compatible updates are acceptable (manifest, vash report). - Branch/revision: choose for unreleased development with a deliberate pin; don't publish a versioned library that relies on a branch/revision dependency (manifest).
- Platform condition: choose for a target edge unavailable on other platforms; don't expect it to raise or lower runtime deployment versions (conditional dependency proposal).
Not for: Swift Codable fallback behavior; see swift-codable-unknown-enum-case-fallback.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
| Supported platforms | Multiple declarations for the same platform are invalid; each must satisfy SDK support, APIs used and dependency minima | Current SwiftPM manifest docs | manifest |
TargetDependencyCondition.when(platforms:) | For example .when(platforms: [.macOS]); attach to .product or .target dependency | Conditional dependency release | proposal |
| Version requirement | Start at the given minimum version and go up to the next major version; prefer for published compatible dependencies | Current manifest docs | version requirement |
| Platform-conditional API | Swift 5.3 supports platform conditionals; use the maximum minimum required by all manifest APIs and dependencies, no higher than the oldest supported toolchain | Release boundary | tools version, conditional API |
Order of operations
1. List every supported platform/toolchain and read the exact resolved dependency's minimums. Derive the floor for each platform from the SDK, used API availability and dependency graph; raising it changes the package's support contract (manifest). 2. If a dependency requires a newer floor, raise that platform's Package.platforms entry or select/replace a dependency version that retains the old floor. vash's October 30, 2025 GoogleMaps wrapper report demonstrates a broad version range selecting an incompatible platform minimum. A runtime availability check alone cannot repair the dependency's own declaration. 3. Attach the condition to the target dependency edge, using the dependency’s platform condition. Guard platform-specific imports and implementation too. Package dependencies still participate in resolution; this API controls target build edges (proposal). 4. Build each advertised platform with a suitable SDK and run the portable targets on each supported non-Apple platform. SwiftPM assigns predefined minimum deployment versions unless supported platforms are configured through the platforms API (manifest, conditional semantics).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
requires minimum platform version | A resolved dependency's floor exceeds the consumer floor | Raise the consumer floor or constrain/replace the dependency while retaining the old support promise | vash report, manifest |
| xcodebuild assumes the highest supported deployment target (reported symptom) | Reported compilation targets iOS 12.0 but the imported module requires iOS 18.1 | Inspect the build arguments and explicitly align archive deployment settings with the package contract | Tanner Bennett, December 21, 2024 |
Missing
- Numeric deployment versions for every supported Apple platform: no package APIs, SDK matrix or dependency manifests are specified. There is no universal correct set of values.
- Later manifest APIs can require a newer tools version than the conditional dependency baseline; choose against the actual manifest, not the compiler's marketing version.
Checked
2026-11-12; SwiftPM manifest reference, conditional-dependency proposal and linked release; dated vash and Tanner Bennett reports read. No package resolution, archive or platform builds executed.
Started from a post by @Swift project, packaged by the editor. Original post