feat(ios): migrate 8 plugins to Swift Package Manager (SPM) #875#884
Open
vicajilau wants to merge 1 commit into
Open
feat(ios): migrate 8 plugins to Swift Package Manager (SPM) #875#884vicajilau wants to merge 1 commit into
vicajilau wants to merge 1 commit into
Conversation
Collaborator
|
@vicajilau: There is already a branch with these changes: |
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.
Description
This PR adds Swift Package Manager (SPM) support to all the plugins in the monorepo that do not have external native dependencies on Google's ML Kit SDK, addressing the transition discussed in #875.
Since Google does not officially support Swift Package Manager for the native ML Kit SDK (it is only distributed via CocoaPods), any plugin depending on it is blocked from a full SPM migration. However, this PR implements a dual-package manager (hybrid) configuration, migrating the independent plugins while maintaining CocoaPods fallback support for the rest.
Migration Summary
1. Migrated Packages (8 Packages)
These plugins do not use the Google ML Kit iOS SDK (they are either GenAI plugins, unimplemented on iOS, or only return mock/stub values) and only depend on
Flutter. They now have aPackage.swiftfile and their source code structured underSources/for SwiftPM compatibility, while keeping their.podspecupdated for CocoaPods:google_mlkit_genai_promptgoogle_mlkit_genai_rewritinggoogle_mlkit_genai_image_descriptiongoogle_mlkit_genai_summarizationgoogle_mlkit_genai_speech_recognitiongoogle_mlkit_genai_proofreadinggoogle_mlkit_document_scannergoogle_mlkit_subject_segmentation2. Blocked Packages - Remaining on CocoaPods (14 Packages)
The core shared package and all active ML Kit features depend directly on the CocoaPods-only Google ML Kit SDK frameworks (
MLKitVision,MLKitFaceDetection, etc.). Since SwiftPM targets cannot link CocoaPods dependencies, these must remain on CocoaPods until Google officially publishes SPM wrappers:google_mlkit_commonsgoogle_mlkit_barcode_scanninggoogle_mlkit_digital_ink_recognitiongoogle_mlkit_entity_extractiongoogle_mlkit_face_detectiongoogle_mlkit_face_mesh_detection(depends ongoogle_mlkit_commons)google_mlkit_image_labelinggoogle_mlkit_language_idgoogle_mlkit_object_detectiongoogle_mlkit_pose_detectiongoogle_mlkit_selfie_segmentationgoogle_mlkit_smart_replygoogle_mlkit_text_recognitiongoogle_mlkit_translationChanges Implemented
ios/Classes/toios/[plugin_name]/Sources/[plugin_name]/in the 8 migrated packages.Package.swiftin the subdirectory of each migrated package, declaring target libraries (with dash-cased names likegoogle-mlkit-genai-promptmatching Flutter's SPM workspace expectation)..podspecfiles to point to the new SPM source path so that legacy CocoaPods integrations continue to work seamlessly..build/directories created by SPM.Verification & Testing
Tested in
packages/exampleon Flutter 3.44.5+ with SPM enabled:flutter config --enable-swift-package-managerflutter clean && flutter pub get