Skip to content

[Bug]: cap sync raises plugin Package.swift to the app's deployment target, breaking SPM on iOS 18+ #8730

Closed

Description

@dennisameling

Capacitor Version

Installed Dependencies:
  @capacitor/cli: 9.0.0-rc.0
  @capacitor/core: 9.0.0-rc.0
  @capacitor/ios: 9.0.0-rc.0

Other API Details

npm 11.17.0, node v24.19.0, Xcode 27.2, SPM

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

Since #8641, cap sync ios raises every plugin's platforms: to the app's deployment target. With IPHONEOS_DEPLOYMENT_TARGET = 18.0, node_modules/@capacitor/app/Package.swift becomes:

// swift-tools-version: 5.9
...
    platforms: [.iOS(.v18)],

and package resolution fails:

node_modules/@capacitor/app/Package.swift:6:23: error: 'v18' is unavailable
note: 'v18' was introduced in PackageDescription 6.0

experimental.ios.spm.swiftToolsVersion (the answer in #8571) only affects CapApp-SPM, so it doesn't help here.

Expected Behavior

Plugins are raised to Capacitor's own minimum (.v16), as the doc comment on patchPackageSwiftDeploymentTarget describes. In cli/src/ios/update.ts, passing that instead of iosVersion fixes it.

Project Reproduction

Steps below (no repo needed)

Additional Information

mkdir repro && cd repro && mkdir www && touch www/index.html
echo '{"appId":"com.example.repro","appName":"repro","webDir":"www","experimental":{"ios":{"spm":{"swiftToolsVersion":"6.0"}}}}' > capacitor.config.json
npm init -y && npm i @capacitor/core@next @capacitor/ios@next @capacitor/app@next && npm i -D @capacitor/cli@next
npx cap add ios
sed -i '' 's/IPHONEOS_DEPLOYMENT_TARGET = [0-9.]*;/IPHONEOS_DEPLOYMENT_TARGET = 18.0;/' ios/App/App.xcodeproj/project.pbxproj
npx cap sync ios
xcodebuild -project ios/App/App.xcodeproj -scheme App -destination 'generic/platform=iOS Simulator' build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Stage

    Done

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions