Migrate Flutter iOS from CocoaPods to Swift Package Manager

Prev Next

The flutter_insider plugin is distributed both as a CocoaPods podspec and as a Swift Package Manager (SwiftPM) package. This guide explains how to move the iOS part of your Flutter application from CocoaPods to SwiftPM. The migration requires no changes to your Dart code; it changes only how the iOS dependencies are resolved and embedded in your application.

We recommend this migration if:

  • your project uses Flutter 3.44 or later, where SwiftPM is enabled by default, or

  • your project uses a Flutter version earlier than 3.44, and you would like to replace CocoaPods with SwiftPM.

CocoaPods remains fully supported. If your application currently builds with CocoaPods and you do not plan to migrate, no action is required.

CocoaPods trunk stops accepting new pod versions on December 2, 2026. For details, refer to the CocoaPods Trunk Read-only Plan.

This guide explains the following concepts:

Requirements

  • Flutter: 3.24 or later. SwiftPM must be enabled manually on Flutter 3.24–3.43 and is enabled by default from Flutter 3.44.

  • flutter_insider: 5.3.0 or later.

  • iOS deployment target: 12.0 or later.

  • Xcode: 26.4 or later.

Enable Swift Package Manager

If your project uses Flutter 3.44 or later, you can skip this step.

If your project uses Flutter 3.24–3.43, run flutter config --enable-swift-package-manager once.

Ensure that Swift Package Manager is also enabled on your CI build machines.

Update the Podfile

With SwiftPM, the plugin embeds InsiderMobileAdvancedNotification in your application. If your Podfile also adds this pod to your notification extension targets, the framework is produced twice, and the build fails with the error Multiple commands produce …InsiderMobileAdvancedNotification.framework.

To prevent this error:

  1. Remove the InsiderMobileAdvancedNotification pod from every notification extension target.

  2. If your Podfile contains no other dependencies, you might remove the Podfile entirely.

  3. Apply this change when you switch to SwiftPM.

Remove the following entries from your Podfile (your target names might differ):

target 'NotificationService' do
  use_frameworks!
  pod 'InsiderMobileAdvancedNotification'
end

target 'NotificationContent' do
  use_frameworks!
  pod 'InsiderMobileAdvancedNotification'
end

The extension targets remain in your Xcode project; only their pod dependency is removed.

Notification extensions

You do not need to add a package or product to your extension targets. Xcode applies the package's framework search path to every target in the project, so the notification service and notification content extensions can use the framework with a standard import statement: import InsiderMobileAdvancedNotification.

The notification content extension requires one additional manual step:

  1. Copy InsiderInterface.storyboard from the Insider iOS SDK package. After the packages are resolved, the file is located at ~/Library/Developer/Xcode/DerivedData/Runner-*/SourcePackages/checkouts/Insider-iOS-SDK/InsiderInterface.storyboard. The storyboard is not shipped as a SwiftPM product, so it is not added to your project automatically.

  2. Add the storyboard to your notification content extension target in Xcode.

  3. Open the storyboard in Xcode and select Inherit Module From Target in the Identity Inspector, so that the runtime can resolve the NotificationViewController class of your extension.

Your existing extension code does not need to change. For the reference implementation, refer to SPM Installation › Configure Targets.

Clean build

Perform a clean build after the migration. The module cache in DerivedData is built from the previous headers, and Xcode might report errors such as Insider.h has been modified since the module file … was built.

To clear the cache, run the following commands:

  1. flutter clean

  2. rm -rf ~/Library/Developer/Xcode/DerivedData/Runner-*

Run the same commands whenever the native SDK version changes.

Verify the migration

Build your application for the simulator with flutter build ios --simulator --debug --no-codesign.

The migration is successful when build/ios/Debug-iphonesimulator/Runner.app/Frameworks contains the following frameworks:

  • InsiderMobile.framework

  • InsiderGeofence.framework

  • InsiderHybrid.framework

  • InsiderMobileAdvancedNotification.framework

and does not contain flutter_insider.framework. You can list the contents of this directory with ls build/ios/Debug-iphonesimulator/Runner.app/Frameworks.

If flutter_insider.framework is present, the plugin was built through CocoaPods, which means SwiftPM is not enabled for your Flutter installation. Return to Enable Swift Package Manager.

Finally, run your application on a physical device and confirm that push notifications with rich content are displayed correctly through your notification extensions.

Roll back to CocoaPods

  1. Disable SwiftPM with flutter config --no-enable-swift-package-manager.

  2. Add the InsiderMobileAdvancedNotification pod back to your notification extension targets in the Podfile.

  3. Set the iOS deployment target to 12.2 or later.

  4. Clear the build cache and install the pods: run flutter clean, then rm -rf ~/Library/Developer/Xcode/DerivedData/Runner-*, then cd ios && pod install.

  5. Build your application again. Runner.app/Frameworks now contains flutter_insider.framework.

What changed

Old

New

Action

The plugin is integrated through CocoaPods, and flutter_insider.framework is in Runner.app/Frameworks.

The plugin is integrated through SwiftPM, and flutter_insider.framework is not in Runner.app/Frameworks.

Enable SwiftPM on Flutter versions earlier than 3.44. See Enable Swift Package Manager.

The Podfile adds the InsiderMobileAdvancedNotification pod to the notification extension targets.

The plugin embeds InsiderMobileAdvancedNotification in your application through SwiftPM.

Remove the pod from the extension targets. See Update the Podfile.

—

InsiderInterface.storyboard is not shipped as a SwiftPM product.

Add the storyboard to the notification content extension target. See Notification extensions.

Native SDK versions follow the plugin's CocoaPods pins.

Native SDK versions follow the Insider iOS SDK Swift package.

None; update packages to receive new native versions.

Dart API of the plugin.

Unchanged.

None.

Troubleshooting

Symptom

Cause

Resolution

Multiple commands produce …InsiderMobileAdvancedNotification.framework

The Podfile adds the pod to an extension target while the plugin also embeds it through SwiftPM.

Remove the pod from the extension targets. See Update the Podfile.

Insider.h has been modified since the module file … was built

The module cache in DerivedData is outdated.

Run flutter clean and delete ~/Library/Developer/Xcode/DerivedData/Runner-*.

flutter_insider.framework is present in Runner.app/Frameworks

SwiftPM is not enabled for your Flutter installation.

Run flutter config --enable-swift-package-manager, or upgrade to Flutter 3.44 or later.