Migrating a Capacitor app to Swift Package Manager
Capacitor is moving from CocoaPods to Swift Package Manager on iOS. Why the switch matters, how SPM compares to CocoaPods, and a step-by-step migration for your Capacitor iOS project.
Capacitor is steadily moving iOS dependency management from CocoaPods to Swift Package Manager (SPM). It's a welcome change — SPM is built into Xcode, faster, and doesn't need a separate pod install step — but migrating an existing project takes a few deliberate steps. This guide covers why the switch matters and how to move your Capacitor iOS project to SPM.
SPM vs CocoaPods
| CocoaPods | Swift Package Manager | |
|---|---|---|
| Tooling | External Ruby gem + pod install | Built into Xcode |
| Speed | Slower resolution, extra step | Faster, integrated |
| Workspace | Generates a .xcworkspace | Native Xcode project |
| Direction | Legacy path | Where Capacitor is heading |
This is a native tooling migration — it changes how iOS builds resolve dependencies, not your web app. OtaKit live updates are unaffected either way.
Migration steps
- Make sure your Capacitor core, CLI, and plugins are current — SPM support landed in recent versions, so align first. See fixing version mismatch.
- Use Capacitor's SPM tooling to generate the Swift Package structure for your iOS project, which declares your plugins as package dependencies instead of pods.
- Confirm each plugin you use ships an SPM-compatible package. Most official plugins do; check community ones individually.
- Remove the CocoaPods artifacts (
Podfile,Pods/,.xcworkspace) once the SPM build is green, and open the native.xcodeprojdirectly. - Build in Xcode and run
npx cap syncto confirm the toolchain is consistent.
Watch for plugin gaps
The one thing that can stall the migration is a plugin without an SPM package. If a dependency you rely on is CocoaPods-only and unmaintained, you'll need to wait for support, contribute it, or replace the plugin — the same unmaintained-dependency risk that shows up in every native migration.
Migrate on a branch and keep the CocoaPods setup until the SPM build is fully green in CI. This is a change you want to be able to back out of cleanly if a plugin surprises you.
Where to go next
See upgrading Capacitor 7 to 8 since the SPM move often rides along with a major bump, and CI automation for keeping the iOS build reproducible.