How to Migrate Your Flutter Project from CocoaPods to Swift Package Manager

By

Introduction

Flutter is officially transitioning from CocoaPods to Swift Package Manager (SwiftPM) as the default dependency manager for iOS and macOS apps, starting with Flutter 3.44. CocoaPods is entering maintenance mode, and its registry will become read-only on December 2, 2026. This guide walks you through the migration process for both app developers and plugin developers, ensuring a smooth transition to Apple's supported ecosystem.

How to Migrate Your Flutter Project from CocoaPods to Swift Package Manager

What You Need

  • Flutter SDK 3.44 or later – Download from flutter.dev or update via flutter upgrade
  • An existing Flutter project with iOS/macOS support enabled
  • Xcode 14+ (for Swift Package Manager compatibility)
  • Basic familiarity with terminal commands and editing pubspec.yaml
  • For plugin developers: Access to the plugin's source code and a GitHub account for filing issues (if needed)

Step-by-Step Migration Guide

For App Developers

The Flutter CLI automates most of the work. Follow these steps to migrate your app.

  1. Step 1: Update Flutter and Dependencies
    Ensure you have Flutter 3.44+ installed. Run flutter upgrade to get the latest version. Then, update all your project dependencies by running flutter pub upgrade. The CLI will handle the transition when you build next.
  2. Step 2: Build Your iOS or macOS App
    Execute flutter build ios or flutter build macos (or simply run via flutter run). The CLI automatically updates your Xcode project to use Swift Package Manager. You don't need to manually adjust CocoaPods configurations.
  3. Step 3: Review Warnings for Unsupported Plugins
    If any of your plugins still rely on CocoaPods, Flutter prints a warning listing those dependencies. The system temporarily falls back to CocoaPods for these plugins, but this fallback will be removed in future releases. If a plugin breaks your build, file an issue with its maintainer (use the Flutter GitHub template) and ask for Swift Package Manager support, or find an alternative package.
  4. Step 4: Verify the Migration
    Check that your Xcode workspace no longer contains CocoaPods references. Open your project in Xcode and inspect the File Inspector – you should see Swift Package dependencies listed in the Project Navigator. Also confirm that pod installations are no longer triggered.
  5. Step 5: Opt-Out Temporarily (If Issues Arise)
    If SwiftPM causes critical issues, you can revert to CocoaPods during troubleshooting. Open pubspec.yaml, locate the flutter section, and add the config block:
    flutter:
      config:
        enable-swift-package-manager: false
    After opting out, please file a bug report at Flutter GitHub Issues with error details, plugin list, and Xcode project files.

For Plugin Developers

If you maintain an iOS or macOS plugin, you must add Swift Package Manager support. Currently, 61% of the top 100 iOS plugins have migrated. Plugins without SwiftPM support now receive lower pub.dev scores.

  1. Step 1: Add a Package.swift File
    Create a Package.swift file at the root of your plugin's iOS/macOS directory. Define the package with the appropriate source files and dependencies. Move your existing source files into the standard Swift package structure (e.g., Sources/PluginName/). Refer to Flutter migration docs for exact syntax.
  2. Step 2: Add FlutterFramework Dependency (2025 Pilot Migrations)
    If you already migrated during the 2025 pilot, you must add FlutterFramework as a dependency in your Package.swift. For example:
    dependencies: [
      .package(url: "https://github.com/flutter/flutter", from: "3.44.0")]
  3. Step 3: Update pub.dev Score
    After completing the migration, run flutter pub publish --dry-run to ensure everything is correct. Your plugin will regain full scoring on pub.dev once the Swift Package Manager support is detected.

Tips for a Smooth Transition

  • Check plugin compatibility early – Use flutter pub deps to list dependencies; note which plugins lack SwiftPM support.
  • Don't ignore warnings – The fallback to CocoaPods is temporary. Plan to replace or update unsupported plugins before the December 2026 deadline.
  • Test on both iOS and macOS – If your app targets both platforms, verify each builds cleanly after migration.
  • Keep an eye on Flutter releases – Future updates may remove the CocoaPods fallback entirely. Stay informed via Flutter release notes.
  • For plugin developers: Join the Flutter plugin community discussions to stay updated on migration best practices.

Migrating to Swift Package Manager will simplify your development environment by removing Ruby and CocoaPods dependencies, giving you access to the entire Swift package ecosystem. Follow these steps, and your Flutter apps will be future-proof.

Related Articles

Recommended

Discover More

Germany's Cyber Extortion Crisis: A Q&A on 2025's Data Leak SurgeHow the UK Lost Its Top Donor Status to the UN Green Climate Fund: A Step-by-Step AnalysisPython 3.15.0 Alpha 3: 10 Key Insights for DevelopersCritical Windows RPC Flaw 'PhantomRPC' Gives Attackers Full System Control; No Patch AvailableUrgent NGINX Vulnerability CVE-2026-42945: Active Exploitation and Mitigation FAQ