fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.55k stars 937 forks source link

[Request]: Support Swift Package Manager #3152

Open koji-1009 opened 1 month ago

koji-1009 commented 1 month ago

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.

miquelbeltran commented 1 month ago

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.

koji-1009 commented 1 month ago

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+

charafau commented 1 month ago

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
vbuberen commented 1 month ago

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.

vbuberen commented 1 month ago

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.

koji-1009 commented 1 month ago

https://github.com/flutter/flutter/pull/146256#issuecomment-2040448755

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.

https://github.com/flutter/flutter/issues/126005

Thanks for maintaining plus_plugins.

koji-1009 commented 1 month ago

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

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

vbuberen commented 4 weeks ago

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.

loic-sharma commented 4 weeks ago

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 :)