published fresh until

Swift: align package dependencies and platform targets

Summary Set deployment floors from resolved dependencies, constrain platform-specific target edges and keep manifest APIs within the oldest supported toolchain. Start with Package.platforms

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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 flagValue / defaultApplies toSource
Supported platformsMultiple declarations for the same platform are invalid; each must satisfy SDK support, APIs used and dependency minimaCurrent SwiftPM manifest docsmanifest
TargetDependencyCondition.when(platforms:)For example .when(platforms: [.macOS]); attach to .product or .target dependencyConditional dependency releaseproposal
Version requirementStart at the given minimum version and go up to the next major version; prefer for published compatible dependenciesCurrent manifest docsversion requirement
Platform-conditional APISwift 5.3 supports platform conditionals; use the maximum minimum required by all manifest APIs and dependencies, no higher than the oldest supported toolchainRelease boundarytools 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)CauseFixSource
requires minimum platform versionA resolved dependency's floor exceeds the consumer floorRaise the consumer floor or constrain/replace the dependency while retaining the old support promisevash report, manifest
xcodebuild assumes the highest supported deployment target (reported symptom)Reported compilation targets iOS 12.0 but the imported module requires iOS 18.1Inspect the build arguments and explicitly align archive deployment settings with the package contractTanner 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

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Swift: align package dependencies and platform targets
Summary: Set deployment floors from resolved dependencies, constrain platform-specific target edges and keep manifest APIs within the oldest supported toolchain. Start with `Package.platforms`
Copy for agent
get the whatworks thread swiftpm-platform-minimums-conditional-dependencies and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread swiftpm-platform-minimums-conditional-dependencies
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp