feat(battery_plus): Support Swift Package Manager
Description
Add SPM support.
https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors
I also noticed an error in the documentation. Since we need to refer to the documentation when reviewing PRs, it will be draft until the next PR is reviewed.
https://github.com/flutter/website/pull/11020
As a working test, I have confirmed that it can be built with flutter 3.24 + CocoaPods, and that it can be built with flutter main channel + SPM. Note that if you try building with main channel + SPM, you will need to remove some steps from your iOS project, as the script to add Pods is no longer needed.
Related Issues
- Related #3152
Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I titled the PR using Conventional Commits.
- [x] I did not modify the
CHANGELOG.mdnor the plugin version inpubspec.yamlfiles. - [x] All existing and new tests are passing.
- [x] The analyzer (
flutter analyze) does not report any problems on my PR.
Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
- [ ] Yes, this is a breaking change (please indicate that with a
!in the title as explained in Conventional Commits). - [x] No, this is not a breaking change.
I would be happy to include flutter/website PR and feel free to review it. There is no need to rush and we would like to discuss how it should be implemented.
The contents of the ios/ directory will not be uploaded to https://cocoapods.org/. So pod spec lint shows multiple problems, but I don't see any major issues.
I'm sure time will solve the problem in the future once the migration from CocoaPods to SPM is complete.