Repository navigation
Add Swift Package Manager Support - #60
CanadianN1nj4 wants to merge 9 commits into
Conversation
|
@WebEferen could you please check this out to enable Swift Package Manager please? |
|
Sure! Thanks for the request and the pull request. Will check it today |
|
Seems like the CI checks are failing, could you please fix them? @CanadianN1nj4 (bump dart/flutter version [3.44.0 - flutter]) |
|
@WebEferen Updated! |
|
Sorry, realized I made a silly mistake. SPM only needs dart/flutter 3.5.0/2.24.0. Updated to fix this |
WebEferen
left a comment
There was a problem hiding this comment.
Thanks for taking on the SPM migration — adding Swift Package Manager support is a good direction for this plugin, and keeping CocoaPods support during the transition is important.
I found a few issues that look build-breaking for the SPM path:
ios/flutter_wallet_card/Package.swiftdeclares the target asflutter-wallet-card, but the source file is underSources/flutter_wallet_card. SwiftPM defaults toSources/<target name>, so it will not find the source directory as written. Please either rename the target toflutter_wallet_cardor set an explicit targetpath.- The target name is hyphenated. SwiftPM targets are Swift modules, so the target/module should use a valid Swift module identifier, normally the plugin name with underscores (
flutter_wallet_card). - The manifest links
.product(name: "FlutterFramework", package: "FlutterFramework"), while the Swift file importsFlutter. Please double-check this against Flutter's SPM plugin-author template; if the linked product does not provide theFluttermodule, iOS builds will fail withno such module 'Flutter'. - The example Xcode project still has a stale
../../ios/my_pluginfile reference, which looks like an automatic migration artifact. - Since CocoaPods support is meant to remain, please also confirm the pod path still builds after moving the Swift source and changing
s.source_files. The example now renamesPodfiletoPodfile.templateand removes Pods xcconfig includes, so it would be helpful to document and test bothflutter build ioswith SPM and the manual CocoaPods flow.
Could you fix the Package.swift target/module setup and clean the example project artifacts, then include confirmation that both SPM and CocoaPods builds work?
|
Hi @CanadianN1nj4, since this PR has been quiet since the July review, I've addressed the requested changes on top of your commits in #65 (your commits are kept). Happy to close mine if you'd rather continue here. |
|
Thanks @GregoryPardini I've been far too busy to be able work on this so I greatly appreciate the help! |
* add Swift Package Manager support * migrate example app to swift package manager * use local relative path for new swift package * Add back podfile as a template to ensure non SPM users can run the example app * remove dead code * bump flutter and dart versions * update incorrectly required dart/flutter version * update example folder with swift package manager * Update to use flutter 3.44.0 as the minimum and also update changelog * fix(ios): use flutter_wallet_card as SwiftPM package and target name 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. * chore(example): remove stale my_plugin file reference Leftover from the automatic SPM migration. The plugin local override (../../ios/flutter_wallet_card) and FlutterFramework references added by Flutter are kept. * fix(ios): align podspec minimum iOS version with Package.swift (13.0) * ci: build with both Swift Package Manager and CocoaPods 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. * style: apply dart format tall style 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> * fix: remove upper bound from flutter SDK constraint pub publish --dry-run warns on caret constraints for the Flutter SDK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * build(example): bump Gradle 8.14.3, AGP 8.11.1, Kotlin 2.2.20 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> --------- Co-authored-by: Thomas Sutlovic <Thomas.Sutlovic@ama.ab.ca> Co-authored-by: Thomas Sutlovic <tsutlovic@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
To help enable a clean transition to Swift Package Manager(SPM), I have followed the instructions from the official documentation: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors#how-to-add-swift-package-manager-support-to-an-existing-flutter-plugin
Support for Cocoapods is still maintained.
Old redundant objective C files were removed from the project.
Automatic migrations to SPM were used. The example project readme was also updated to include details on how to run the project via cocoapods. (Automatic migration wouldn't happen because of the abnormal podsfile)
Environment versions were bumped following the instructions. Minimum iOS version was also bumped.