Skip to main content
The Userpilot Flutter example already uses Swift Package Manager (SPM). Follow these steps when updating an older copy of the example or a Flutter app that still uses CocoaPods. Run the Flutter commands from your app directory (example/ if you are using the Userpilot Flutter repository). Save your existing iOS project configuration before migrating so you can restore it if needed.
Flutter 3.44 and later enable SPM by default. The configuration command above also enables it if you previously turned it off. See Flutter’s SPM guide for app developers. During migration, you may see output such as:
Your Xcode project now has a FlutterGeneratedPluginSwiftPackage dependency. It includes userpilot_flutter, which installs the native Userpilot iOS SDK through its own Package.swift. You do not need to add the Userpilot package separately to the main app target. Custom CocoaPods dependencies, including dependencies belonging to an app extension, may still need to be migrated manually. On another flutter run, you may see a notice like this:

Removing CocoaPods integration

Before removing CocoaPods, confirm that every plugin and custom Pod dependency has an SPM equivalent, and transfer any custom build settings or scripts from your Podfile. From your app directory:
Keep the Generated.xcconfig includes. Remove any remaining CocoaPods includes from custom configuration files as well. Delete the generated ios/Pods/ and ios/.symlinks/ directories if they remain. In Xcode:
  1. If you manually configure push notifications and still reference SwiftUserpilotFlutterPlugin, rename it to UserpilotFlutterPlugin. The compiler provides a rename diagnostic. See Push Notifications for the current callbacks.
  2. Remove any remaining reference to Pods.xcodeproj from the workspace.
  3. Remove any remaining Pods group from the Runner project.
  4. Confirm that FlutterGeneratedPluginSwiftPackage is linked to Runner and that its scheme includes the Run Prepare Flutter Framework Script build pre-action.
  5. If your app has a notification service extension, migrate its dependencies as described below.

Apps with a notification service extension

The Userpilot Flutter example has no notification service extension target. The Userpilot iOS 1.4.0 package exposes the Userpilot library and does not provide a separate notification service extension product. Skip this section for the standard example. If your own app has an extension for another dependency:
  1. Select Runner > Project > Runner > Package Dependencies.
  2. Add that dependency’s Swift package and assign its extension-compatible product to your notification service extension target, following the dependency’s integration guide.
  3. Keep the extension’s build number aligned with the containing app. If Xcode reports a warning such as:
    Set the extension’s Info.plist value to:
  4. Under Runner > Project > Runner > Info > Configurations, set the extension’s Based on Configuration File to the corresponding Flutter xcconfig for each build configuration. If the extension already has its own xcconfig, retain it and include the Flutter-generated settings there so FLUTTER_BUILD_NUMBER is defined.
Return to the app directory, then build and run:

Going back to CocoaPods

From the app directory:
Disabling SPM does not remove its Xcode integration. Follow Flutter’s SPM removal instructions to remove the generated package reference, linked product, and build pre-action. Restore your pre-migration Podfile, CocoaPods xcconfig includes, and any custom target configuration. Restore only the migration-related changes from version control, preserving other work. Then reinstall dependencies:

References