Skip to content

chore: migrate sample app to use spm#329

Merged
mrehan27 merged 17 commits intofeature/spm-supportfrom
mbl-1614-spm-app-integration
Apr 8, 2026
Merged

chore: migrate sample app to use spm#329
mrehan27 merged 17 commits intofeature/spm-supportfrom
mbl-1614-spm-app-integration

Conversation

@mrehan27
Copy link
Copy Markdown
Contributor

@mrehan27 mrehan27 commented Apr 7, 2026

closes: MBL-1614

Summary

  • Remove Customer.io pod dependencies from SPM app's Podfile (Runner and NSE targets), Customer.io SDK now resolved via SPM
  • Link FlutterGeneratedPluginSwiftPackage to NSE target for Customer.io push dependencies via SPM
  • Bump firebase_core to ^4.6.0 and firebase_messaging to ^16.1.3 (required for Flutter SPM support)
  • Set enable-swift-package-manager: true for SPM app and false for CocoaPods app in pubspec.yaml
  • Add import UserNotifications to NSE (required for SPM builds)
  • Update apps/README.md with iOS dependency management details

How it works

  • Runner target: Customer.io SDK dependencies (DataPipelines, MessagingInApp, Location, MessagingPushFCM, CioFirebaseWrapper) are automatically resolved via the plugin's Package.swift through Flutter's SPM integration
  • NSE target: Links FlutterGeneratedPluginSwiftPackage to access CIO push dependencies, no separate package needed
  • CocoaPods app: Unchanged, explicitly disables SPM via pubspec.yaml config

Test plan

  • ✅ SPM app builds iOS successfully (flutter build ios --simulator --debug)
  • ✅ SPM app builds Android successfully (flutter build apk)
  • ✅ CocoaPods app still builds with CocoaPods (no SPM conflicts)
  • ✅ NSE compiles and links CioMessagingPushFCM via SPM

Note

Medium Risk
Medium risk because it changes iOS build/dependency wiring (CocoaPods vs SPM) and updates Firebase package major versions, which can break CI or sample app builds if any plugin integration differs between environments.

Overview
Migrates the flutter_sample_spm iOS sample app to resolve Customer.io dependencies via Swift Package Manager instead of explicit CocoaPods wiring, including linking FlutterGeneratedPluginSwiftPackage into the Notification Service Extension and removing Pod-based extension/framework embed steps.

Updates CI to explicitly enable SPM for the SPM sample app, adds per-app pubspec.yaml enable-swift-package-manager flags (SPM app true, CocoaPods app false), bumps firebase_core/firebase_messaging to SPM-compatible major versions, and refreshes docs to describe the two iOS dependency management modes.

Reviewed by Cursor Bugbot for commit 6bc2363. Bugbot is set up for automated code reviews on this repo. Configure here.

Shahroz16 and others added 14 commits April 2, 2026 21:10
- Move source files from ios/Classes/ to ios/customer_io/Sources/customer_io/ (SPM-compatible layout)
- Add Package.swift for Swift Package Manager resolution
- Remove ObjC bridge files (CustomerIOPlugin.h/m) - no longer needed with SPM
- Rename SwiftCustomerIOPlugin -> CustomerIOPlugin
- Change #if CIO_LOCATION_ENABLED to #if canImport(CioLocation) for SPM compatibility
- Update podspec source_files paths to point to new location
- Add import Foundation to CustomerIOSDKConfigMapper.swift
- Add SPM build verification CI job
- Update .gitignore for SPM build artifacts
Firebase iOS SDK requires Swift 6.0+ features (sending keyword,
AccessLevelOnImport) which are only available in Xcode 16+.
Flutter's SPM integration looks for a product named 'customer_io'
(matching pluginClass from pubspec.yaml). The hyphenated name
'customer-io' would cause SPM dependency resolution to fail.
The auto-update-native-sdks workflow now also updates the hardcoded
iOS SDK version in Package.swift when bumping native_sdk_version in
pubspec.yaml, keeping CocoaPods and SPM in sync.
Flutter's generated FlutterGeneratedPluginSwiftPackage converts
underscores to hyphens when referencing plugin products. The
generated Package.swift looks for 'customer-io' (not 'customer_io'),
so the original hyphenated name was correct.
The plugin should not force a specific push provider. Use the base
MessagingPush module (matching the podspec 'nopush' default). Customers
add their specific push provider (APN/FCM) in their own Xcode project.
The plugin code does not import any MessagingPush module. Only
DataPipelines and MessagingInApp are needed. Push provider (APN/FCM)
is added by customers in their own Xcode project.
Building for device requires code signing even with --no-codesign
when the Xcode project has manual signing configured. Simulator
build avoids this and still verifies SPM dependency resolution
and compilation.
Use MacOS-15+iOS-26 branch instead of main to match the existing
build-ios-sample-app job.
The amiapp_flutter requires ios/Env.swift (gitignored, generated from
Env.swift.example) and a .env file to compile. Also run flutter pub get
before building.
Rewrite the SPM CI job to follow the same setup pattern as the
existing build-ios-sample-app job:
- Create .env with placeholder credentials
- Copy Env.swift.example to Env.swift
- Setup flutter and pub get
- Setup iOS environment with matching action version
- Build for simulator to avoid code signing
@mrehan27 mrehan27 self-assigned this Apr 7, 2026
@mrehan27 mrehan27 requested a review from a team as a code owner April 7, 2026 20:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


  • flutter_sample_spm: 329.17.0 (29594072)

flutter:

config:
enable-swift-package-manager: false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added project level config so sample app isn't affected by global level config

flutter:

config:
enable-swift-package-manager: true
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added project level config so sample app isn't affected by global level config

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9ac3201. Configure here.

@mrehan27 mrehan27 force-pushed the mbl-1614-spm-app-integration branch from 9ac3201 to ab785be Compare April 7, 2026 20:57
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPM bumps firebase_core to ^4.6.0 and firebase_messaging to ^16.1.3, we should probably update here too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's required for SPM support, will do that later in separate PR for pods sample

Base automatically changed from shahroz/spm-plugin-changes to feature/spm-support April 8, 2026 10:23
@mrehan27 mrehan27 merged commit 26f7f58 into feature/spm-support Apr 8, 2026
15 checks passed
@mrehan27 mrehan27 deleted the mbl-1614-spm-app-integration branch April 8, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants