fluttercommunity/plus_plugins

[Request]: Support Swift Package Manager

Closed this issue · 11 comments

Plugin

battery_plus, connectivity_plus, device_info_plus, network_info_plus, package_info_plus, sensors_plus, share_plus

Use case

When Swift Package Manager(SPM) support is added to the flutter stable channel, developers will get the plus_plugins package via SPM on iOS/macOS.

Proposal

With the release of Flutter 3.24.0, SPM support has been announced in the main channel.

https://medium.com/flutter/flutter-3-24-dart-3-5-204b7d20c45d
https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors

Since SPM support is compatible with CocoaPods support, I think it would be wonderful if the popular plus_plugins could support SPM as early as possible.

Target packages are following.

  • battery_plus
  • connectivity_plus
  • device_info_plus
  • network_info_plus
  • package_info_plus
  • sensors_plus
  • share_plus

Thanks for the heads-up!

Flutter plugins should both Swift Package Manager and CocoaPods until further notice.

Swift Package Manager adoption will be gradual. Plugins that don't support CocoaPods won't be usable by projects that haven't migrated to Swift Package Manager yet. Plugins that don't support Swift Package Manager can cause problems for projects that have migrated.

Just to clarify, we should not remove the CocoaPods support, but only add support for SPM.

Thank you for the clarification!

I too think it would be good to keep support for CocoaPods and add support for SPM as well, as in the package managed by flutter.dev.
https://github.com/flutter/packages/pulls?q=is%3Apr+is%3Aclosed++%22Add+Swift+Package+Manager+support%22+

Current status for this

Plugin Status
battery_plus PR
connectivity_plus PR
device_info_plus PR
network_info_plus PR
package_info_plus PR
sensors_plus PR
share_plus PR

Would like to join the discussion here.

First of all, thanks a lot for taking care of creating PRs for every plugin.

I would like to not merge any of those changes till SPM support gets out of the state of early stages and there is no warning on top of the page saying that it is a subject of change. I am against merging any half-baked solutions. There is no value except additional possible overhead due to changes that Google might introduce. For those who want to experiment - they can do it in their forks.

I think it would be wonderful if the popular plus_plugins could support SPM as early as possible.

Yes, it is a good point, but we are pretty quick to react with releases when some changes are introduced, so I don't see a problem of not having SPM support for now.

flutter/flutter#146256 (comment)

According to a developer comment, CocoaPods and SPM cannot be used at the same time. Therefore, in order for developers to be able to use SPM once SPM support becomes stable, it would be a good idea for packages containing iOS/macOS code to support SPM in advance.
plus_plugins is one of the most popular packages with swift/objective-c code. For this reason, I have created (perhaps a little too quickly) an issue.


Since other packages depend on plus_plugins, I feel that early SPM support would be beneficial.
On the other hand, I can agree that it is not stable enough to release code that supports SPM. I have been tracking SPM support out of personal interest and feel that the key issues have been resolved, but as noted, there is a "Warning" sentence in the documentation.

How about reflecting the status of the following issues in SPM support? For example, if all bugs have been resolved, or the flutter create -t plugin template has been updated, I think it's time to release it.

flutter/flutter#126005

Thanks for maintaining plus_plugins.

https://blog.cocoapods.org/CocoaPods-Support-Plans/

CocoaPods has entered maintenance mode so it will be necessary to migrate to SPM in the future.

it would be a good idea for packages containing iOS/macOS code to support SPM in advance.

As I mentioned earlier as soon as there are no warnings or notes saying that SPM support is still under development and a subject for change we are good to go. But definitely don't want to merge and release any half-baked solutions.

How about reflecting the status of the following issues in SPM support?

We already have this issue which is enough at the moment, I believe.

Hello, I'm from the Flutter team and I work on the Swift Package Manager feature. You all are amazing, I'm impressed you're already working on this!!

We're in the very early days of SPM support. We really appreciate any and all feedback on the current migration experience! If you run into issues or have questions, please reach out to the Flutter team. You can ping me at @loic-sharma, send a message to the #hackers-ios channel on Flutter’s discord, or open a GitHub issue.

As I mentioned earlier as soon as there are no warnings or notes saying that SPM support is still under development and a subject for change we are good to go.

@vbuberen, our docs are a bit overly broad. SPM support is subject to change for app developers but not for plugin authors. If you add SwiftPM compatibility to a Flutter plugin, that plugin should not be broken by any upcoming changes. Please let me know if there's anything we could do to reduce any concerns here :)

Hey @loic-sharma 👋🏻
Sorry, totally missed your comment and forgot that I didn't reply. Thank you very much for jumping here and reassuring that plugin authors have nothing to worry about with SPM. For me the yellow warning on top of the docs page about SPM was the main confusing point that influenced my previous comments.
In such case we will proceed with PRs adding SPM support and try to release new versions shortly.

I have just released new versions with the support of SPM, so closing as resolved.

Please try it out and provide feedback/PRs if you find any issues. Thanks to everyone who took part in helping with this topic.