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

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

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

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.

Tags:

Recommended

Discover More

Cloudflare's Code Orange: Fail Small Project Complete – A More Resilient NetworkExploring VECT 2.0 Ransomware Irreversibly Destroys Files Over 131KB on Windo...From Mormon Culture to McDonald's Menu: The Dirty Soda Phenomenon ExplainedInstructure Data Breach: Student Information Stolen Amid Hacker Extortion Threats5 Critical Lessons from a ClickHouse Billing Slowdown: How We Uncovered a Hidden Bottleneck