Skip to content

feat(ios): add Swift Package Manager support for Core#454

Open
nurlangarash wants to merge 2 commits into
AppsFlyerSDK:masterfrom
nurlangarash:feat/swift-package-manager-support
Open

feat(ios): add Swift Package Manager support for Core#454
nurlangarash wants to merge 2 commits into
AppsFlyerSDK:masterfrom
nurlangarash:feat/swift-package-manager-support

Conversation

@nurlangarash

Copy link
Copy Markdown

Summary

Adds a Package.swift manifest 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:

The following plugins do not support Swift Package Manager for ios: … appsflyer_sdk … This will become an error in a future version of Flutter.

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 $AppsFlyerPurchaseConnector Podfile flag.
  • The ObjC #ifdef ENABLE_PURCHASE_CONNECTOR guards 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

  • Move ios/Classes/ios/appsflyer_sdk/Sources/appsflyer_sdk/ (impl .m) and .../include/appsflyer_sdk/ (public .h). All git mv renames.
  • Add ios/appsflyer_sdk/Package.swift (swift-tools-version: 5.9, iOS 12.0). Depends on the AppsFlyerFramework-Static SPM package (product AppsFlyerLib-Static, pinned 6.18.0), matching the podspec's static_framework = true + AppsFlyerFramework 6.18.0. The existing #import <AppsFlyerLib/AppsFlyerLib.h> resolves against that module unchanged.
  • Update the Core subspec source_files / public_header_files to the new shared paths. PurchaseConnector subspec unchanged.

pluginClass: AppsflyerSdkPlugin continues to resolve via <appsflyer_sdk/AppsflyerSdkPlugin.h>.

Testing status

⚠️ Please run CI / a device build before merging. I followed the official Flutter plugin-author conventions and verified the AppsFlyerFramework-Static SPM product name + 6.18.0 tag resolve, but I could not run a full iOS build here. Verification:

flutter config --enable-swift-package-manager
cd example && flutter clean && flutter run        # SPM path (Core)
flutter config --no-enable-swift-package-manager
cd example && flutter clean && flutter run        # CocoaPods path (Core + PurchaseConnector)

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.

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>
Copilot AI review requested due to automatic review settings June 22, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.swift for 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 .gitignore and documents the change in CHANGELOG.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.

Comment thread ios/appsflyer_sdk/Package.swift
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@yanashenyang

Copy link
Copy Markdown

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!

@yanashenyang

Copy link
Copy Markdown

The following plugins do not support Swift Package Manager for ios:

  • appsflyer_sdk
    This will become an error in a future version of Flutter. Please contact the plugin maintainers to request Swift Package Manager adoption.

@yanashenyang

Copy link
Copy Markdown
The following plugins do not support Swift Package Manager for ios:
  - appsflyer_sdk
This will become an error in a future version of Flutter. Please contact the plugin maintainers to request Swift Package Manager adoption.

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