Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork924
[WIP] Add Swift Package Manager support#1440
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
77789db to3e05616CompareTimHoogstrate commentedApr 10, 2025
I want to Link this geolocator PR, although you are probably related:Baseflow/flutter-geolocator#1630. One quick question:@engels-all-win-software, because this PR is already relatively old. Are you still available for doing some updates? |
engels-all-win-software commentedApr 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hey@TimHoogstrate yeah, I want to keep this updated, sorry for running late. I was wondering which way should we turn to move forward in implementing this; based on the proposal I described , there are alternative ways to set the preprocessor macros like in a new xcconfig file containing the macros, this would streamline the process instead of passing environment variables to Xcode, also it'll feel familiar with the current podfile based approach. What are you thoughts on this?. Currently updating this branch to resolve conflicts. Once we have the approach for implementing Swift Package Manager, we can start writing a migration guide. |
- Add environment variable-based permission defines (PERMISSION_CAMERA, etc.)- Allow consumers to selectively enable only needed permissions- Default all permissions to 0 (disabled) for minimal footprint- Keep essential header search paths- Simplified structure without unnecessary framework dependenciesBased on approach fromBaseflow#1440
- Move source files to SPM-compliant structure (ios/permission_handler_apple/Sources/)- Add Package.swift with environment-based permission defines- Update podspec to reference new file locations- Add GitHub workflow matrix testing for both CocoaPods and SPM- Maintain backward compatibility with existing CocoaPods setupFollows onBaseflow#1440 andfixesBaseflow#1439
Uh oh!
There was an error while loading.Please reload this page.
This PR relates to#1439
This pull request (PR) aims to implement Swift Package Manager (SPM) support while maintaining CocoaPods. It also tracks progress on streamlining the developer experience. This PR is open for discussion, welcoming new ideas and feedback on any issues or omissions.
I've implemented an SPM file and updated the podspec file to point to the new source files. I've also created the folder structure suggested by the Flutter team in their SPM migration article:https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors#116-tab-panel.
To run the Example app with SPM, remove (or rename) the Podfile and execute
pod deintegratein the example app's iOS folder. Then, enable SPM in Flutter withflutter config --enable-swift-package-managerand executeflutter runwith the following environment variable exports:I've chosen to activate permission modules through environment variables, similar to the approach described here:Conditionally compile code in a Flutter plugin using Swift Package Manager. This simplifies the process. A potential improvement is creating an xcconfig file containing the desired permissions as variables. This file could then be imported into the Release or Debug xcconfig files, making it a one-time setup and eliminating the need to export these variables for each run.
Here are some useful links with additional information:
Pre-launch Checklist
pubspec.yamlwith an appropriate new version according to thepub versioning philosophy, or this PR is does not need version changes.CHANGELOG.mdto add a description of the change.///).main.dart format .and committed any changes.flutter analyzeand fixed any errors.