-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[camera_avfoundation] Implementation swift migration #8988
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
[camera_avfoundation] Implementation swift migration #8988
Conversation
4cc7939
to
9ba0c7b
Compare
9ba0c7b
to
24ef036
Compare
...ra/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/QueueUtils.m
Outdated
Show resolved
Hide resolved
...amera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/QueueUtils.h
Outdated
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift
Show resolved
Hide resolved
1d00092
to
912ce03
Compare
c0faae7
to
d99fe5c
Compare
I'm confused, the ObjC target doesn't define a "swift" module right? isn't it still a clang module? |
@@ -13,9 +13,13 @@ A Flutter plugin to use the camera from your Flutter app. | |||
s.author = { 'Flutter Dev Team' => '[email protected]' } | |||
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/camera_avfoundation' } | |||
s.documentation_url = 'https://pub.dev/packages/camera_avfoundation' | |||
s.source_files = 'camera_avfoundation/Sources/camera_avfoundation/**/*.{h,m}' | |||
s.public_header_files = 'camera_avfoundation/Sources/camera_avfoundation/include/**/*.h' | |||
s.module_map = 'camera_avfoundation/Sources/camera_avfoundation/include/CameraPlugin.modulemap' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's been a while since i touched this. Why we are removing the module map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not supported with Swift static libraries.
[!] Using Swift static libraries with custom module maps is currently not supported. Please build `camera_avfoundation` as a framework or remove the custom module map.
It's still the same issue you've encountered here flutter/plugins#6369
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i completely forgot about this! thanks for the reference.
dependencies: [], | ||
exclude: ["include/camera_avfoundation-umbrella.h", "include/CameraPlugin.modulemap"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question to the umbrella header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm missing something but I don't see much value in having a custom umbrella header without a custom module map. Without the module map cocoapods generate the public umbrella header that includes everything either way
d99fe5c
to
57e7fe1
Compare
Yes, there won't be a swift module for the ObjC target. I've corrected the description |
Migrates camera implementation as part of flutter/flutter#119109
This PR includes theCameraPlugin
class migration. Some additional changes regarding imports were necessary to keep Swift Package Manager compatibility. SPM does not support mixed languages in a single target. I assume there might be a better solution so I'm open to suggestionsAfter splitting only a new target for SPM is created in this PR and the objc implementation is moved to a dedicated directory.
During the plugin's migration from ObjC to Swift, there will be a transitional period during which the implementation will be mixed, with some parts already migrated to Swift and some still in ObjC. This is somewhat problematic with SwiftPM. SwiftPM does support packages with mixed language implementation but different languages have to be in separate targets. Every target defines a separate module which means that in some cases both have to be imported. However, this only applies to SwiftPM with Cocoapods we can mix Swift and ObjC code in the same pod and have a single module. Simmingly the best solution is to use conditional imports for the additional module when SwiftPM during the migration.
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3