flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 Add Swift Package Manager support

Open loic-sharma opened this issue 1 year ago • 2 comments

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.

loic-sharma avatar Aug 21 '24 16:08 loic-sharma

Pull request to update firebase_core is here: https://github.com/firebase/flutterfire/pull/12786

loic-sharma avatar Aug 21 '24 18:08 loic-sharma

firestore: https://github.com/firebase/flutterfire/pull/13329

charafau avatar Sep 20 '24 00:09 charafau

@russellwheatley I saw you recently added a bunch of PRs regarding SPM. Are you also currently working on firebase_messaging? Otherwise I'll try to start making a PR? Thanks, and best regards.

I created #16786

Gustl22 avatar Nov 28 '24 09:11 Gustl22

@Gustl22 - much appreciated 🙏

russellwheatley avatar Nov 28 '24 15:11 russellwheatley

Hey @loic-sharma - I'm trying to port over app installations plugin to Swift integration. This plugin is slightly different as it contains Swift and Objective-c source code. This is a problem because you cannot mix different languages in same target AFAIK. Therefore, I've separated the source code and put into two different targets.

Here is what I've done in the Package.swift: https://github.com/firebase/flutterfire/pull/16814/files#diff-edea417c9f367770f068c480012a27a623d686b5cc017f5d331837cd4e261e2eR97-R123

I've tried importing the generated swift header file like so: https://github.com/firebase/flutterfire/pull/16814/files#diff-92d2e67c7bae825b709e7dc6f0c02b7b0545ecbfc988295fc160773245a3307bR12

but it cannot find it. It seems the file is generated in the derived data. Don't suppose there are instructions for handling this in Flutter or if you have any ideas on how to resolve this?

russellwheatley avatar Dec 03 '24 11:12 russellwheatley

Plugins with Swift Package Manager support:

  • [x] firestore
  • [x] analytics
  • [x] core
  • [x] auth
  • [x] real time database
  • [x] remote config
  • [x] storage
  • [x] messaging
  • [x] app check
  • [x] crashlytics
  • [x] app installations
  • [x] dynamic links
  • [x] performance
  • [x] model downloader
  • [x] in app messaging

russellwheatley avatar Dec 06 '24 16:12 russellwheatley

@russellwheatley wow, good job!

charafau avatar Dec 11 '24 15:12 charafau