Skip to content

Migrate iOS dependencies from CocoaPods to Swift Package Manager #235

Description

@wizzomafizzo

Summary

Migrate the Capacitor iOS project from CocoaPods to Swift Package Manager (SPM). Capacitor 8 supports SPM and uses it by default for new iOS projects.

This is not an immediate build-breaking change: existing CocoaPods packages and builds will remain available. CocoaPods trunk is scheduled to become read-only on December 2, 2026, so new pod versions will no longer be published there. Firebase plans to stop publishing CocoaPods releases in October 2026.

Current state

Most installed Capacitor plugins already ship a Package.swift. Two dependencies currently block a clean migration:

  • @capacitor-mlkit/barcode-scanning does not currently support SPM because Google does not officially distribute ML Kit through SPM. Capawesome has an experimental SPM pull request open: feat: add experimental Swift Package Manager (SPM) support capawesome-team/capacitor-mlkit#330
  • capacitor-zeroconf does not ship a Package.swift and has no current SPM work upstream. A maintained fork or first-party replacement will likely be required. Its iOS implementation is mostly Swift, so converting its Objective-C Capacitor bridge to CAPBridgedPlugin should be practical.

Preference: wait for Capawesome barcode scanner SPM support rather than replace it now. A Zeroconf fork is acceptable when migration work begins.

Proposed work

  • Recheck Capawesome barcode scanner SPM status
  • Fork or replace capacitor-zeroconf with an SPM-compatible Capacitor 8 package
  • Confirm every installed iOS plugin ships a valid Package.swift
  • Run npx cap spm-migration-assistant on macOS
  • Add generated local CapApp-SPM package and debug.xcconfig in Xcode
  • Verify custom MfaAuthenticationPlugin.swift can import FirebaseAuth through the SPM dependency graph
  • Commit Package.resolved for reproducible builds
  • Build/archive and test Firebase auth/MFA, barcode scanning, Zeroconf discovery, NFC, RevenueCat, and live updates on device

Do not delete and recreate ios/: the project contains custom native source, entitlements, signing settings, and Firebase configuration.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency file

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions