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.
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.
- Step 1: Update Flutter and Dependencies
Ensure you have Flutter 3.44+ installed. Runflutter upgradeto get the latest version. Then, update all your project dependencies by runningflutter pub upgrade. The CLI will handle the transition when you build next. - Step 2: Build Your iOS or macOS App
Executeflutter build iosorflutter build macos(or simply run viaflutter run). The CLI automatically updates your Xcode project to use Swift Package Manager. You don't need to manually adjust CocoaPods configurations. - 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. - 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. - Step 5: Opt-Out Temporarily (If Issues Arise)
If SwiftPM causes critical issues, you can revert to CocoaPods during troubleshooting. Openpubspec.yaml, locate thefluttersection, and add the config block:
After opting out, please file a bug report at Flutter GitHub Issues with error details, plugin list, and Xcode project files.flutter: config: enable-swift-package-manager: false
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.
- Step 1: Add a
Package.swiftFile
Create aPackage.swiftfile 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. - Step 2: Add FlutterFramework Dependency (2025 Pilot Migrations)
If you already migrated during the 2025 pilot, you must add FlutterFramework as a dependency in yourPackage.swift. For example:dependencies: [ .package(url: "https://github.com/flutter/flutter", from: "3.44.0")] - Step 3: Update pub.dev Score
After completing the migration, runflutter pub publish --dry-runto 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 depsto 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
- React Native 0.84: Performance Leap with Hermes V1 and Streamlined Builds
- Google Unveils 'Googlebook' Project: Premium Chromebook Successor with Upgrade Path for Select Models
- CoreCLR Takes Over: What .NET 11 Means for MAUI Developers
- Flutter AI Features Face Production Pitfalls: Experts Warn of Policy Violations, Cost Overruns
- Flutter 3.44 to Default to Swift Package Manager, Phasing Out CocoaPods
- Glasses-Free 3D iPhone: What the Latest Samsung Rumor Reveals
- How to Manage Financial Strategy in a Hypergrowth AI Company: Lessons from Anthropic's CFO
- React Native 0.81: Key Updates for Android 16, iOS Builds, and Deprecations