feat(ios): add Swift Package Manager support for Core#454
Conversation
Adds a Package.swift manifest alongside the existing podspec so the Core integration builds with Flutter 3.44+ Swift Package Manager while remaining CocoaPods-compatible. The optional PurchaseConnector subspec stays CocoaPods-only for now (blocked by flutter/flutter#161182). - Move ios/Classes -> ios/appsflyer_sdk/Sources/appsflyer_sdk (impl .m) and ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk (public .h) - Add ios/appsflyer_sdk/Package.swift (iOS 12.0), depending on the AppsFlyerFramework-Static SPM package (product AppsFlyerLib-Static, 6.18.0) to match the static_framework podspec dependency - Update Core subspec source_files / public_header_files to the new paths; PurchaseConnector subspec unchanged Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Swift Package Manager (SPM) support for the iOS Core integration of appsflyer_sdk (while keeping CocoaPods support intact) to address Flutter 3.44+ warnings about missing SPM support.
Changes:
- Introduces an iOS
Package.swiftfor SPM-based integration of the Core target. - Relocates Core iOS sources/headers into an SPM-compatible
Sources/.../include/...layout and updates the podspec globs accordingly. - Updates iOS
.gitignoreand documents the change inCHANGELOG.md.
Reviewed changes
Copilot reviewed 4 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ios/appsflyer_sdk/Package.swift | Adds SPM manifest for Core, including dependency on AppsFlyerFramework-Static. |
| ios/appsflyer_sdk.podspec | Updates Core subspec source_files and public_header_files to the new directory layout. |
| ios/.gitignore | Ignores SwiftPM build artifacts in the iOS folder. |
| CHANGELOG.md | Adds an “Unreleased” entry documenting Core SPM support. |
| ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsFlyerStreamHandler.m | Core stream handler implementation moved into SPM structure. |
| ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsflyerSdkPlugin.m | Core plugin implementation moved into SPM structure. |
| ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsFlyerAttribution.m | Attribution helper implementation moved into SPM structure. |
| ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/*.h | Public headers moved into SPM include/ structure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Hi team, thanks for the great work on this PR! 🙏 Our project has fully migrated to Swift Package Manager, and this Core SPM support is exactly what we need. Is there anything blocking the merge, or a rough timeline for when it might land? Happy to help test if that's useful. Thanks again! |
|
The following plugins do not support Swift Package Manager for ios:
|
|
Summary
Adds a
Package.swiftmanifest alongside the existing podspec so the Core AppsFlyer integration builds with Flutter 3.44+ Swift Package Manager (SPM) while remaining fully CocoaPods-compatible.Under Flutter 3.44+ the plugin emits:
This removes that warning for the large majority of apps. Relates to #364 and the existing draft #370.
Why Core-only
#370 stalled because of the PurchaseConnector subspec (the author cited the upstream Flutter limitation flutter/flutter#161182). This PR deliberately scopes SPM to the Core subspec — the default integration — and leaves PurchaseConnector exactly as-is on CocoaPods:
PurchaseConnector/sources are untouched and the subspec still requires the$AppsFlyerPurchaseConnectorPodfile flag.#ifdef ENABLE_PURCHASE_CONNECTORguards are unchanged, so the SPM Core target compiles without the PurchaseConnector Swift code.This unblocks SPM for everyone who doesn't use PurchaseConnector, without waiting on the Flutter fix.
Changes
ios/Classes/→ios/appsflyer_sdk/Sources/appsflyer_sdk/(impl.m) and.../include/appsflyer_sdk/(public.h). Allgit mvrenames.ios/appsflyer_sdk/Package.swift(swift-tools-version: 5.9, iOS 12.0). Depends on the AppsFlyerFramework-Static SPM package (productAppsFlyerLib-Static, pinned6.18.0), matching the podspec'sstatic_framework = true+AppsFlyerFramework 6.18.0. The existing#import <AppsFlyerLib/AppsFlyerLib.h>resolves against that module unchanged.source_files/public_header_filesto the new shared paths. PurchaseConnector subspec unchanged.pluginClass: AppsflyerSdkPlugincontinues to resolve via<appsflyer_sdk/AppsflyerSdkPlugin.h>.Testing status
Reference: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors
I know #364 was closed as "not planned" — opening this because a Core-only scope sidesteps the PurchaseConnector blocker that stalled #370. Happy to adjust or close if you'd rather drive this differently.