-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
Swift Package Manager support #1150
Comments
@navaronbracke are you working on this change? Or can I give it a shot? |
I was planning on taking this up, but haven't gotten around to doing so yet. Feel free to take this up! Also, if you think that doing #782 first, would make things easier, feel free to do so! And if not, we can revisit that one later. |
@navaronbracke I'll give this one a try first |
@navaronbracke I followed the documentation mentioned in the work item and made the appropriate changes. If we migrate to swift package manager, I’m encountering an error "Parse Issue (Xcode): Module 'image_picker_ios' not found” this seems to be a common issue with this module when we switch over to swift package manager. Found an open issue in Git : flutter/flutter#152550 These new changes will not affect the existing Cocoapods installation and build process. The plugin works fine when run with the flag "flutter config --no-enable-swift-package-manager” after adding the SPM changes. Issue only comes up when we run with "flutter config --enable-swift-package-manager”. We can try removing this module and attempting to build but I’m not sure if this is a viable solution as it might remove a functionality from the plugin. Changes are present here : https://github.com/Xa69/mobile_scanner/tree/users/nimish/1150-SPM-Support-Changes Let me know if I should try by removing the module itself. |
Good finding! I had a look and I see that flutter/packages#6833 is a reland of Swift Package Manager support for that plugin. (the first attempt was reverted due to the issue you found) I see that the pubspec of our example does not use the latest version of
You could try the following:
|
Tried with both solutions suggested, observing the same error when trying with SPM |
Hmm, since the conversation in that other issue is still ongoing (they asked for some things in a reproducible sample's iOS project to investigate further), I do suggest we turn off the |
Alright then I’ll try to figure out how to go about doing that and push the changes to the same branch. |
@navaronbracke After removing the image_picker from the pubspec.yaml file in the ‘example’ directory for iOS, I’m getting this build error : I’m not able to figure out where else the image_picker is used from the universal search or going through the directories. |
AFAIK we only use it here in the example, but nowhere else in this repository: https://github.com/juliansteenbakker/mobile_scanner/blob/master/example/lib/scanner_button_widgets.dart Perhaps doing a |
@navaronbracke The steps you suggested did work, surprised VS code didn’t find it’s usage. I have a concern regarding disabling the use of image picker, this will affect users irrespective of whether they’re building using Cocoapods or SPM. I’d suggest we proceed with this change once the image_picker_ios issue is resolved to prevent blocking users from utilising the feature. I did try what you suggested and I’m getting an error 'Module ‘integration_test’ not found' now this can be resolved I believe but since I had the query wanted to confirm if it’s a good idea to proceed with this change at this time? |
Perhaps you had filters on that excluded files when searching in VS Code? I do agree, perhaps we should wait until For I'm not sure why that would be causing a problem, though? Perhaps because integration_test itself isn't migrated to SPM? Or was it a stale build on your end? Regarding your contribution, I would propose that you already open up the pull request as a draft. Then I can take a look at it, and you won't lose the work (as it exists on a remote then) |
@navaronbracke I’m not entirely sure why integration_test is throwing the error because we already have the dev_dependency included in the pubspec.yaml. It is possible that this issue is only occurring on my system as I have set up flutter for the first time or could require a transition to SPM but from my searches online it looks to be a flutter specific dependency and not SPM or Cocoapods. Anyways the draft PR with my changes is up and linked below : You can review the changes and let me know if there’s something wrong, if you have the time I’d request you attempt to build it on your machine and see if you can reproduce the issue. Note: Building with the SPM flag disabled works fine since it falls back to Cocoapods. |
I will take a look later this week. Thanks again for working on this! |
Hello @Xa69, you're the second person to report this problem. Unfortunately, I'm having difficulties reproducing this problem on my machine. Would you be able to share a sample project and instructions to reproduce this problem? |
Hi @loic-sharma I’m not able to reproduce this as well as the build is getting stuck due to this other issue. I’m not sure what could be causing this as I’m using the latest Cocoapods however I will try to figure out how to reproduce this to help you debug further. CC: @navaronbracke |
In #953 people seem to suggest it has to do with what cocapods version you are using? |
@navaronbracke 1.15.2 |
Also @navaronbracke this build issue regarding the ‘MLKit’ is the same as our conversation which is ongoing here #1155. Could you please try on your system and check if you can repro the ‘image_picker’ issue? I don’t remember any explicit steps for reproducing the issue. Just running flutter build used to reproduce the ‘image_picker’ issue after enabling Swift package manager through the config command 'flutter config --enable-swift-package-manager’ You just need to checkout my branch 'users/nimish/1150-SPM-Support-Changes’ and try to build the example app. |
I can't reproduce this on an Intel Mac, on Flutter 3.24.1, using a fresh copy of your branch. |
Swift Package Manager support is available from version 7.0.0 (currently still in beta, due to some other things being worked on as well) |
Flutter will eventually deprecate and then remove support for CocoaPods. We should add Swift Package Manager support instead.
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
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:
The text was updated successfully, but these errors were encountered: