Migration9 min read

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

CocoaPodsSwift Package Manager
ToolingExternal Ruby gem + pod installBuilt into Xcode
SpeedSlower resolution, extra stepFaster, integrated
WorkspaceGenerates a .xcworkspaceNative Xcode project
DirectionLegacy pathWhere 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

  1. Make sure your Capacitor core, CLI, and plugins are current — SPM support landed in recent versions, so align first. See fixing version mismatch.
  2. 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.
  3. Confirm each plugin you use ships an SPM-compatible package. Most official plugins do; check community ones individually.
  4. Remove the CocoaPods artifacts (Podfile, Pods/, .xcworkspace) once the SPM build is green, and open the native .xcodeproj directly.
  5. Build in Xcode and run npx cap sync to 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.

Related docs