Skip to content

feat(ios): add Swift Package Manager support#144

Open
nurlangarash wants to merge 1 commit into
superwall:mainfrom
nurlangarash:feat/swift-package-manager-support
Open

feat(ios): add Swift Package Manager support#144
nurlangarash wants to merge 1 commit into
superwall:mainfrom
nurlangarash:feat/swift-package-manager-support

Conversation

@nurlangarash

Copy link
Copy Markdown

Summary

Adds a Package.swift manifest alongside the existing podspec so superwallkit_flutter builds with Flutter 3.44+ Swift Package Manager (SPM) while remaining fully CocoaPods-compatible.

Under Flutter 3.44+ the plugin currently emits:

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

This PR removes that warning. CocoaPods is not removed — both dependency managers consume the same source tree during the transition (CocoaPods becomes read-only on 2 Dec 2026).

Changes

  • Move ios/Classes/ios/superwallkit_flutter/Sources/superwallkit_flutter/ (shared source tree used by both SPM and CocoaPods). All moves are git mv renames, so history is preserved.
  • Add ios/superwallkit_flutter/Package.swift:
    • swift-tools-version: 5.9, platform iOS 14.0 (matches the podspec floor).
    • Depends on the native SuperwallKit SPM package (github.com/superwall/Superwall-iOS), pinned exact: "4.14.2" to match s.dependency 'SuperwallKit', '4.14.2'.
    • Follows the official Flutter-team plugin convention (dependencies: [] for Flutter itself — the engine is injected automatically by the SPM build; no Flutter package is declared).
  • Update ios/superwallkit_flutter.podspec source_files to the new shared path.
  • Ignore SPM build artifacts (.build/, .swiftpm/, Package.resolved).

The plugin is 100% Swift and uses Pigeon, so no Objective-C umbrella/header handling is needed — the Pigeon-generated SuperwallHostGenerated.swift simply moves with the other sources.

Reference

Followed the official Flutter guide for plugin authors: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors, cross-checked against the SPM manifests in flutter/packages (e.g. url_launcher_ios, shared_preferences_foundation).

Testing status

⚠️ Please run CI / a device build before merging. I authored the source restructure and manifest by following the official conventions and verified the SuperwallKit SPM product name/version resolve, but I was not able to run a full iOS device/simulator build in my environment. Suggested verification:

flutter config --enable-swift-package-manager
cd example && flutter clean && flutter run        # SPM path
flutter config --no-enable-swift-package-manager
cd example && flutter clean && flutter run        # CocoaPods path (backward-compat)

Happy to adjust the platform floor, version pin (e.g. .upToNextMajor(from: "4.0.0")), or layout to match your preferences.

Adds a Package.swift manifest alongside the existing podspec so the plugin
builds with Flutter 3.44+ Swift Package Manager while remaining fully
CocoaPods-compatible.

- Move ios/Classes -> ios/superwallkit_flutter/Sources/superwallkit_flutter
  (shared source tree consumed by both SPM and CocoaPods)
- Add ios/superwallkit_flutter/Package.swift (iOS 14.0), depending on the
  SuperwallKit SPM package (github.com/superwall/Superwall-iOS) pinned to
  4.14.2 to match the podspec
- Update podspec source_files to the new shared path
- Ignore SPM build artifacts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant