Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swift Package Manager support #80

Open
loic-sharma opened this issue Dec 3, 2024 · 7 comments
Open

Add Swift Package Manager support #80

loic-sharma opened this issue Dec 3, 2024 · 7 comments

Comments

@loic-sharma
Copy link

Hello,

Flutter is migrating to Swift Package Manager. Please add Swift Package Manager support to your plugin.

Flutter will eventually deprecate and then remove support for CocoaPods. Adding Swift Package Manager support future-proofs your plugins.

How to add Swift Package Manager support to your plugins

You can find the migration guide here: 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

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.

Thank you for your wonderful contributions to the Flutter ecosystem!

Why is Flutter migrating to Swift Package Manager?

CocoaPods is now in maintenance mode.

Swift Package Manager support is one of Flutter’s most requested features: flutter#33850.

Flutter's Swift Package Manager integration has several benefits:

  1. Access to the Swift package ecosystem. Flutter plugins can use the growing ecosystem of Swift packages.
  2. Simplifies Flutter installation. Swift Package Manager is bundled with Xcode. In the future, you won’t need to install Ruby and CocoaPods to target iOS or macOS.
@diegotori
Copy link
Collaborator

@loic-sharma thanks for that. Do you know when SPM support will hit stable, since according to the docs, it says that it's still under development.

Once SPM support is stable, then I'll go ahead and migrate it.

@diegotori diegotori pinned this issue Dec 3, 2024
@loic-sharma
Copy link
Author

@diegotori We're doing a release this month that will make the SwiftPM feature stable behind an opt-in.

However, the SwiftPM package structure is already stable today. Plugin authors are encouraged to begin migrating today :)

Please let me know if you have any follow-up questions!

@diegotori
Copy link
Collaborator

@loic-sharma in that case, I won't be able to get to it until after the 19th, since I'm gonna be out of the country for the next couple of weeks.

I'm assuming by then, you guys would have released a new Flutter version. I'll definitely get it done then.

@diegotori
Copy link
Collaborator

@loic-sharma I also accept PRs if this makes the process go smoother.

@loic-sharma
Copy link
Author

There's no rush - feel free to land this when you're ready. I hope you have wonderful holidays :)

@diegotori
Copy link
Collaborator

diegotori commented Dec 3, 2024

@loic-sharma one more thing: when I add SPM support, what happens to the existing Cocoapods integration? Will SPM replace Cocoapods, and not live in parallel next to SPM, for cases such as backwards compatibility.

Just curious how the transition will work when not every package will migrate to SPM right away.

@loic-sharma
Copy link
Author

For now, your plugin should support both CocoaPods and SwiftPM in parallel. This allows your plugin to be used by folks that are on both new and old Flutter SDKs. For more information, see: 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

When Flutter's SwiftPM feature is available, Flutter will use the SwiftPM to build a plugin if it supports it. Flutter will fallback to using CocoaPods for plugins that don't support SwiftPM yet.

In the future, we'll remove CocoaPods support from Flutter and unmigrated plugins will be broken. This is likely at least a year away from happening, if not later.

Please let me know if you have more questions! :)

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

No branches or pull requests

2 participants