Skip to content

fix(ios): fix SPM product name and wire example-app to SPM#419

Merged
ryaa merged 1 commit into
masterfrom
bugfix/417-spm-build-fails-on-ios-capacitor-8-product-capacitorcommunitycamerapreview-not-found
Apr 17, 2026
Merged

fix(ios): fix SPM product name and wire example-app to SPM#419
ryaa merged 1 commit into
masterfrom
bugfix/417-spm-build-fails-on-ios-capacitor-8-product-capacitorcommunitycamerapreview-not-found

Conversation

@ryaa

@ryaa ryaa commented Apr 17, 2026

Copy link
Copy Markdown
Member

Summary

This PR fixes iOS Swift Package Manager support for Capacitor 8 by aligning the plugin's exported Swift package product name with what Capacitor generates for SPM consumers.

It also keeps the example app on the migrated SPM-based iOS setup and wires the local CapApp-SPM package into the Xcode project so the example app can be opened, built, and run again for local validation.

Changes

  • fix the root Package.swift library product name mismatch

    • rename CapacitorCommunityCameraPreviewPlugin to CapacitorCommunityCameraPreview
    • keep the package name, Swift target name, and podspec unchanged
  • restore a working example-app iOS SPM workflow

    • keep the example app on the SPM migration output
    • wire the local CapApp-SPM package into App.xcodeproj
    • keep the generated SPM support files required by the migrated setup

Why this change is needed

Capacitor 8 generates SPM references using the plugin name-derived product name CapacitorCommunityCameraPreview, but the plugin previously exported the library product as CapacitorCommunityCameraPreviewPlugin.

That mismatch caused SPM resolution to fail for iOS consumers.

Separately, after migrating the example app from CocoaPods to SPM, the Xcode project still needed local package wiring so import Capacitor and the full app build could work again.

Validation

Verified locally with:

cd example-app/ios/App/CapApp-SPM
xcodebuild -scheme CapApp-SPM -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' build
cd example-app/ios/App
xcodebuild -project App.xcodeproj -scheme App -sdk iphonesimulator -configuration Debug -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO build
npm run verify:ios

Notes

  • this PR does not change the Swift target name
  • this PR does not change the CocoaPods podspec
  • the example app now follows the SPM-based iOS workflow rather than the old CocoaPods workspace flow

Changes:
- rename the Package.swift library product to CapacitorCommunityCameraPreview so Capacitor 8 SPM consumers can resolve the plugin
- keep the existing Swift target name and podspec unchanged
- wire the example-app Xcode project to the generated CapApp-SPM local package
- keep the example-app on the migrated SPM flow so Xcode build/run works again for local validation
@ryaa ryaa merged commit 8a9f878 into master Apr 17, 2026
2 checks passed
@ryaa ryaa deleted the bugfix/417-spm-build-fails-on-ios-capacitor-8-product-capacitorcommunitycamerapreview-not-found branch April 17, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SPM build fails on iOS (Capacitor 8) – product 'CapacitorCommunityCameraPreview' not found

1 participant