Skip to content

Add Swift Package Manager support (follow-up to #60) - #65

Merged
WebEferen merged 16 commits into
WebEferen:masterfrom
GregoryPardini:spm-support
Oct 6, 2026
Merged

WebEferen merged 16 commits into
WebEferen:masterfrom
GregoryPardini:spm-support

Conversation

@GregoryPardini

Copy link
Copy Markdown
Contributor

Supersedes #60. This keeps all of @CanadianN1nj4's commits and adds fixes for the points in the review from July 6.

Review points

1–2. Package.swift target and module name. The package and target are now named flutter_wallet_card, which matches Sources/flutter_wallet_card and is a valid Swift module name. The library product keeps the hyphenated name flutter-wallet-card. This follows Flutter's plugin template (flutter_tools/templates/plugin_swift_package_manager/ios.tmpl/.../Package.swift.tmpl).

3. FlutterFramework product vs import Flutter. No change was needed. Flutter's plugin template links .product(name: "FlutterFramework", package: "FlutterFramework"), and that product provides the Flutter module. The SPM build below compiles import Flutter without errors.

4. Stale ../../ios/my_plugin reference. Removed from the example Xcode project. The 78DABEA2… (../../ios/flutter_wallet_card) and 78466649… (FlutterFramework) references stay, because Flutter's SPM migration adds them on purpose for plugin examples (swift_package_manager_integration_migration.dart).

5. CocoaPods path.

  • The podspec minimum iOS version is now 13.0, the same as Package.swift.
  • Once migrated, the example app can't be built with SPM disabled. xcodebuild fails to resolve ../FlutterFramework for the local plugin override. A fresh flutter create -t plugin example fails the same way, so this is how Flutter behaves and not something specific to this plugin. Podfile.template is therefore removed, and the example README no longer says that renaming it enables CocoaPods.
  • The CocoaPods integration is checked by building a new app that depends on the plugin with SPM disabled. This runs in CI as a new step in test-ios, and the example README documents both flows.

Verification (Flutter 3.47.5, Xcode, iOS simulator and device build)

  • SPM: flutter build ios --no-codesign in example/ passes. The plugin is built as a Swift package (flutter_wallet_card.swiftmodule), and Podfile.lock only contains Flutter.
  • CocoaPods: a new app with SPM disabled and a path dependency on the plugin builds. Podfile.lock contains flutter_wallet_card and OpenSSL-Universal.

Side note (not in this PR)

FlutterWalletCardPlugin.swift only imports Flutter, PassKit and UIKit, so the OpenSSL dependency (OpenSSL-Package in SPM, OpenSSL-Universal in the podspec) looks unused on iOS. If you agree, I can remove it in a follow-up PR.

🤖 Generated with Claude Code

CanadianN1nj4 and others added 13 commits May 7, 2026 00:27
The target was named flutter-wallet-card, which is not a valid Swift module
name and does not match Sources/flutter_wallet_card. Follow Flutter's plugin
template: package and target use the plugin name, the library product uses
the hyphenated name.
Leftover from the automatic SPM migration. The plugin local override
(../../ios/flutter_wallet_card) and FlutterFramework references added by
Flutter are kept.
Once migrated, the example app cannot be built with SPM disabled (same as
the example generated by flutter create -t plugin), so Podfile.template is
removed. The CocoaPods integration is checked by building a new app that
depends on the plugin with SPM disabled. Both flows are documented in the
example README.
@WebEferen

Copy link
Copy Markdown
Owner

Approving workflows. when the tests will be green, I will merge this PR.
Thanks for this fix :)

GregoryPardini and others added 3 commits October 6, 2026 13:16
The SDK constraint bump to ^3.12.0 enables the tall formatter style,
so CI's dart format check failed on the existing code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pub publish --dry-run warns on caret constraints for the Flutter SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flutter 3.44 rejects Gradle < 8.7. Also pin Kotlin's JVM target to 17
to match the Java compile options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GregoryPardini

Copy link
Copy Markdown
Contributor Author

Thanks! The previous run failed on four jobs. I've pushed fixes for all of them:

  • Test on Ubuntu: the SDK bump to ^3.12.0 turns on the new "tall" dart format style, so I reformatted the code (d7f0fcf).
  • Package Analysis: pub publish --dry-run warned about the upper bound in flutter: ^3.44.0. It's now >=3.44.0 (683a82a).
  • Example App Build / Flutter Version Compatibility: Flutter 3.44 rejects Gradle below 8.7. The example now uses Gradle 8.14.3, AGP 8.11.1 and Kotlin 2.2.20 (599597e).

I checked these jobs locally with Flutter 3.44.0. Could you approve the workflow run again? Thanks!

@WebEferen
WebEferen merged commit 246881f into WebEferen:master Oct 6, 2026
7 checks passed
@WebEferen

Copy link
Copy Markdown
Owner

thanks to both @GregoryPardini and @CanadianN1nj4.
Changes are merged and will be released shortly.

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