From 70ca10f2922d722a58dffdc240b981f935936d3f Mon Sep 17 00:00:00 2001 From: Nurlan Garash Date: Mon, 22 Jun 2026 15:46:49 +0400 Subject: [PATCH 1/2] feat(ios): add Swift Package Manager support for Core 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) --- CHANGELOG.md | 4 ++ ios/.gitignore | 5 +++ ios/appsflyer_sdk.podspec | 4 +- ios/appsflyer_sdk/Package.swift | 41 +++++++++++++++++++ .../appsflyer_sdk}/AppsFlyerAttribution.m | 0 .../appsflyer_sdk}/AppsFlyerStreamHandler.m | 0 .../appsflyer_sdk}/AppsflyerSdkPlugin.m | 0 .../appsflyer_sdk}/AppsFlyerAttribution.h | 0 .../appsflyer_sdk}/AppsFlyerStreamHandler.h | 0 .../appsflyer_sdk}/AppsflyerSdkPlugin.h | 0 ...lutterAppDelegate+AppsFlyerStreamHandler.h | 0 11 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 ios/appsflyer_sdk/Package.swift rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk}/AppsFlyerAttribution.m (100%) rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk}/AppsFlyerStreamHandler.m (100%) rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk}/AppsflyerSdkPlugin.m (100%) rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk}/AppsFlyerAttribution.h (100%) rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk}/AppsFlyerStreamHandler.h (100%) rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk}/AppsflyerSdkPlugin.h (100%) rename ios/{Classes => appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk}/FlutterAppDelegate+AppsFlyerStreamHandler.h (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 797b2237..e48e806a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Versions +## Unreleased + +- iOS: Add Swift Package Manager (SPM) support for the Core integration alongside CocoaPods. Resolves the "plugin does not support Swift Package Manager" warning under Flutter 3.44+. The optional PurchaseConnector subspec remains CocoaPods-only for now (blocked by flutter/flutter#161182). Relates to #364 / #370. + ## 6.18.0 - Updated Android SDK from 6.17.6 to 6.18.0 diff --git a/ios/.gitignore b/ios/.gitignore index 710ec6cf..7581b6a7 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -34,3 +34,8 @@ Icon? .tags* /Flutter/Generated.xcconfig + +# Swift Package Manager +.build/ +.swiftpm/ +Package.resolved diff --git a/ios/appsflyer_sdk.podspec b/ios/appsflyer_sdk.podspec index 34981194..92e60c8e 100644 --- a/ios/appsflyer_sdk.podspec +++ b/ios/appsflyer_sdk.podspec @@ -18,8 +18,8 @@ Pod::Spec.new do |s| end s.subspec 'Core' do |ss| - ss.source_files = 'Classes/**/*' - ss.public_header_files = 'Classes/**/*.h' + ss.source_files = 'appsflyer_sdk/Sources/appsflyer_sdk/**/*.{h,m}' + ss.public_header_files = 'appsflyer_sdk/Sources/appsflyer_sdk/include/**/*.h' ss.dependency 'Flutter' ss.ios.dependency 'AppsFlyerFramework','6.18.0' end diff --git a/ios/appsflyer_sdk/Package.swift b/ios/appsflyer_sdk/Package.swift new file mode 100644 index 00000000..003f3ea2 --- /dev/null +++ b/ios/appsflyer_sdk/Package.swift @@ -0,0 +1,41 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +// This manifest provides Swift Package Manager support for the AppsFlyer "Core" +// integration (the default subspec). The optional PurchaseConnector subspec is +// intentionally NOT included here — it remains CocoaPods-only for now because of +// the open Flutter limitation tracked in flutter/flutter#161182. Apps that use +// PurchaseConnector continue to opt in via the $AppsFlyerPurchaseConnector Podfile +// flag and CocoaPods; everyone else gets SPM support and loses the warning. + +let package = Package( + name: "appsflyer_sdk", + platforms: [ + .iOS("12.0") + ], + products: [ + .library(name: "appsflyer-sdk", targets: ["appsflyer_sdk"]) + ], + dependencies: [ + // Static variant matches the podspec's `static_framework = true`. + // Product "AppsFlyerLib-Static" wraps the binary target "AppsFlyerLib", + // so the existing `#import ` keeps resolving. + .package(url: "https://github.com/AppsFlyerSDK/AppsFlyerFramework-Static.git", exact: "6.18.0") + ], + targets: [ + .target( + name: "appsflyer_sdk", + dependencies: [ + .product(name: "AppsFlyerLib-Static", package: "AppsFlyerFramework-Static") + ], + // Implementation (.m) files in Sources/appsflyer_sdk/, public headers (.h) + // in Sources/appsflyer_sdk/include/appsflyer_sdk/. The header search path + // lets the .m/.h files resolve their siblings by bare name. + cSettings: [ + .headerSearchPath("include/appsflyer_sdk") + ] + ) + ] +) diff --git a/ios/Classes/AppsFlyerAttribution.m b/ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsFlyerAttribution.m similarity index 100% rename from ios/Classes/AppsFlyerAttribution.m rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsFlyerAttribution.m diff --git a/ios/Classes/AppsFlyerStreamHandler.m b/ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsFlyerStreamHandler.m similarity index 100% rename from ios/Classes/AppsFlyerStreamHandler.m rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsFlyerStreamHandler.m diff --git a/ios/Classes/AppsflyerSdkPlugin.m b/ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsflyerSdkPlugin.m similarity index 100% rename from ios/Classes/AppsflyerSdkPlugin.m rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/AppsflyerSdkPlugin.m diff --git a/ios/Classes/AppsFlyerAttribution.h b/ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/AppsFlyerAttribution.h similarity index 100% rename from ios/Classes/AppsFlyerAttribution.h rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/AppsFlyerAttribution.h diff --git a/ios/Classes/AppsFlyerStreamHandler.h b/ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/AppsFlyerStreamHandler.h similarity index 100% rename from ios/Classes/AppsFlyerStreamHandler.h rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/AppsFlyerStreamHandler.h diff --git a/ios/Classes/AppsflyerSdkPlugin.h b/ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/AppsflyerSdkPlugin.h similarity index 100% rename from ios/Classes/AppsflyerSdkPlugin.h rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/AppsflyerSdkPlugin.h diff --git a/ios/Classes/FlutterAppDelegate+AppsFlyerStreamHandler.h b/ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/FlutterAppDelegate+AppsFlyerStreamHandler.h similarity index 100% rename from ios/Classes/FlutterAppDelegate+AppsFlyerStreamHandler.h rename to ios/appsflyer_sdk/Sources/appsflyer_sdk/include/appsflyer_sdk/FlutterAppDelegate+AppsFlyerStreamHandler.h From 98d9938dd2fea6b4bb1a4b40665444945044b401 Mon Sep 17 00:00:00 2001 From: Nurlan Garash <68768916+nurlangarash@users.noreply.github.com> Date: Wed, 24 Jun 2026 11:04:11 +0400 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- ios/appsflyer_sdk/Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/appsflyer_sdk/Package.swift b/ios/appsflyer_sdk/Package.swift index 003f3ea2..fdc3b6da 100644 --- a/ios/appsflyer_sdk/Package.swift +++ b/ios/appsflyer_sdk/Package.swift @@ -13,10 +13,10 @@ import PackageDescription let package = Package( name: "appsflyer_sdk", platforms: [ - .iOS("12.0") + .iOS(.v12) ], products: [ - .library(name: "appsflyer-sdk", targets: ["appsflyer_sdk"]) + .library(name: "appsflyer_sdk", targets: ["appsflyer_sdk"]) ], dependencies: [ // Static variant matches the podspec's `static_framework = true`.