feat: Swift Package Manager support for iOS and macOS - #1142
Draft
hiroshihorie wants to merge 3 commits into
Draft
feat: Swift Package Manager support for iOS and macOS#1142hiroshihorie wants to merge 3 commits into
hiroshihorie wants to merge 3 commits into
Conversation
Adds ios/livekit_client and macos/livekit_client Swift packages using the Flutter SPM plugin layout. Sources are symlinks into shared_swift and ios/Classes so they stay the single source of truth. CocoaPods integration is unchanged and both podspecs keep working as before. The packages depend on flutter_webrtc's Swift package for the WebRTC framework, mirroring the podspec dependency. Requires a flutter_webrtc release that includes its own SPM support (PR 2062).
…S projects Mirrors the changes flutter's automatic SPM migration makes (package reference, product dependency, and the prepare pre-action in the Runner scheme). Committing them avoids the migration step at build time, which currently fails to validate projects whose plugins declare SwiftPM dependencies on other plugins. CocoaPods phases are untouched so the example still builds with SPM disabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Swift Package Manager support for the iOS and macOS plugins, following the Flutter SPM plugin convention:
ios/livekit_client/Package.swiftandmacos/livekit_client/Package.swift, withSources/livekit_client/symlink trees intoshared_swift/(and the iOS broadcast files inios/Classes/), so the existing sources stay the single source of truth.../flutter_webrtc, resolved by the Flutter tool) and consume itsflutter-webrtcandWebRTCproducts. Reusing flutter_webrtc's WebRTC binary target keeps a single copy of the xcframework in the package graph, mirroring how the podspecs share the WebRTC-SDK pod today.flutterwould generate.CocoaPods is unchanged: podspecs and
Classes/are untouched, and apps with SPM disabled keep building through pods.Depends on
WebRTClibrary product export. This PR can only land after a flutter_webrtc release that ships SPM support, at which point the pinned flutter_webrtc version needs a bump.Testing
With Flutter 3.44.1 (SPM on by default) and a local
dependency_overridespointing flutter_webrtc at the PR 2062 branch:flutter build macos --debugandflutter build ios --debug --simulatorof the example both succeed.LiveKitPlugin/FlutterWebRTCPluginsymbols in the app binaries) with exactly one embeddedWebRTC.framework.permission_handler_applehas no SPM support and keeps building through CocoaPods in hybrid mode.Note for local testing: the Flutter tool copies plugins that declare SwiftPM dependencies on other plugins into the app's build directory with rsync. With the example app living inside this repo that copy recurses into itself (flutter_tools bug, to be filed upstream). Workaround is to make
example/builda symlink to a directory outside the repo before building.