### Navigate to Project Directory Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/Example/README.md Use this command to change your current directory to the Example project folder. ```bash cd Example ``` -------------------------------- ### Open Example App Workspace Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/TESTING.md Navigate to the Example directory and open the Xcode workspace to begin manual testing. This is the most critical testing phase. ```bash cd Example open Example.xcworkspace ``` -------------------------------- ### Open Example App Workspace Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Opens the SwiftUI demo app's workspace in Xcode. This app uses the package via a local path and is intended for device validation. Note: The simulator is not supported on Apple Silicon. ```bash cd Example && open Example.xcworkspace ``` -------------------------------- ### Full ML Kit Build Pipeline Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Executes the complete pipeline: pod install, Xcodebuild for both SDKs, Info.plist injection, XCFramework creation, FAT-object fix, and zipping into GoogleMLKit/. This is the primary command for local builds. ```bash make run ``` -------------------------------- ### Recommended Testing Flow Script Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/TESTING.md A comprehensive script for the recommended testing workflow, including building, static analysis, example app testing, and committing changes. ```bash # 1. Build new version ./scripts/build_all.sh # 2. Run static analysis ./scripts/verify_runtime.sh # 3. Test Example app cd Example open Example.xcworkspace # Build and run on device # Test all features # Check console # 4. If all tests pass, commit cd .. git add Podfile Podfile.lock Package.swift Resources/ git commit -m "Update to MLKit " git tag -a -m "Release " ``` -------------------------------- ### Build ML Kit with ASDF Shimmed Ruby Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Performs the same actions as 'make run' but ensures the ASDF-shimmed Ruby environment is set up first. Use this if your Ruby environment is managed by ASDF. ```bash ./build_with_asdf.sh ``` -------------------------------- ### Open Xcode Project Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/Example/README.md Opens the Xcode project file for the ML Kit Demo App. ```bash open Example.xcodeproj ``` -------------------------------- ### Bootstrap ML Kit Builder Tool Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Builds the xcframework-maker tool, which is a prerequisite for the full build pipeline. Run this before the full build. ```bash make bootstrap-builder ``` -------------------------------- ### Batch Build ML Kit for Multiple Versions Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Automates the process of building multiple ML Kit versions. It bumps versions in Podfile and Info.plists, runs the full build, recomputes SHA256 checksums, rewrites Package.swift, and performs auto commits and tagging. ```bash ./scripts/batch_build.sh [v2] ... ``` -------------------------------- ### Test Full Local Build Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Command to execute a full local build using the `build_all.sh` script. This process requires Xcode and can take a significant amount of time. ```bash # This will take some time and requires Xcode ./scripts/build_all.sh 5.0.0 ``` -------------------------------- ### Bootstrap xcframework-maker Builder Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/AUTOMATION.md Build the custom 'xcframework-maker' tool before creating XCFrameworks. This tool handles static frameworks with FAT object files and adds arm64 simulator support. ```bash make bootstrap-builder ``` -------------------------------- ### Download ML Kit Resource Bundles Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/Example/README.md Executes a script to download necessary ML Kit resource bundles from a GitHub release. ```bash ./scripts/download_bundles.sh ``` -------------------------------- ### Run Build-Time Verification Script Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/TESTING.md Execute this script to perform automatic checks during the build process. It verifies the existence of XCFramework zip files, Package.swift syntax, and Info.plist presence. ```bash ruby scripts/verify_build.rb ``` -------------------------------- ### Orchestrate Full Build Process with Shell Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Automates the complete build process, including pre-flight checks, version updates, XCFramework compilation, checksum calculation, and final verification. This script is a comprehensive tool for ensuring a successful build. ```bash ./scripts/build_all.sh ``` ```bash ./scripts/build_all.sh 5.1.0 ``` -------------------------------- ### Manually Copy Info.plist Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/TESTING.md Use this command to manually copy an Info.plist file if it's missing from a framework. This is a solution for 'The bundle doesn't contain...' errors. ```bash cp Resources/MLKitCommon-Info.plist \ GoogleMLKit/MLKitCommon.xcframework/ios-arm64/MLKitCommon.framework/Info.plist ``` -------------------------------- ### Build All MLKit XCFrameworks Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/AUTOMATION.md Automates the full build process for a specified MLKit version. This includes updating Podfile and Info.plist, running the build, calculating checksums, and verifying the output. The release artifacts are then prepared for upload. ```bash ./scripts/build_all.sh ``` ```bash ./scripts/build_all.sh 7.0.0 ``` -------------------------------- ### Perform Static Analysis with Runtime Verification Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/TESTING.md Run this script after building to check for static issues. It validates XCFramework architectures, Info.plist presence, symbol tables, and Package.swift target definitions. ```bash ./scripts/verify_runtime.sh ``` -------------------------------- ### Add Camera and Photo Library Permissions Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/Example/README.md XML snippet for Info.plist to request camera and photo library access, essential for ML Kit image processing. ```xml NSCameraUsageDescription Camera access is required to capture images for ML Kit detection NSPhotoLibraryUsageDescription Photo library access is required to select images for ML Kit detection ``` -------------------------------- ### Upload ML Kit Release Assets to GitHub Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Uploads the generated GoogleMLKit/*.xcframework.zip files to an existing GitHub Release. Ensure the release is created first using 'gh release create '. ```bash ./scripts/upload_release.sh ``` -------------------------------- ### Test Podfile Update Locally Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md A local test sequence to verify the `update_version.rb` script without performing a full build. It includes steps to update the Podfile, review changes with git diff, and revert if necessary. ```bash # Test Podfile update only ruby scripts/update_version.rb 5.0.0 # Review changes git diff Podfile # Revert if needed git checkout Podfile ``` -------------------------------- ### Update ML Kit Version Script Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/README.md Use these bash commands to check for new ML Kit versions and build them. Replace `` with the actual ML Kit version. ```bash # Check for updates ruby scripts/check_mlkit_version.rb # Build new version (replace with actual version) ./scripts/build_all.sh ``` -------------------------------- ### Verify ML Kit Build Artifacts Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Performs pre- and post-flight checks on the build artifacts. It verifies the presence of Info.plists, the successful build of xcframework-maker, the existence of zip files, and the parsability of Package.swift. ```ruby ruby scripts/verify_build.rb ``` -------------------------------- ### Upload XCFramework Artifacts to GitHub Release Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/AUTOMATION.md Uploads newly built XCFramework zip files to an existing GitHub release. It checks for the release, deletes old assets if they exist, and then uploads the new ones. The release must be created manually beforehand. ```bash ./scripts/upload_release.sh ``` ```bash ./scripts/upload_release.sh 7.0.0 ``` -------------------------------- ### Verify Runtime Static Analysis with Shell Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Conducts static analysis on built XCFrameworks to detect potential runtime issues, such as architecture compatibility and Info.plist presence. This script should be run after building XCFrameworks and before manual device testing. ```bash ./scripts/verify_runtime.sh ``` ```bash ./scripts/verify_runtime.sh 7.0.0 ``` -------------------------------- ### Build ML Kit XCFrameworks via GitHub Actions Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Manually triggers the GitHub Actions workflow to build ML Kit XCFrameworks. This workflow runs 'make run', updates checksums, and creates/updates the GitHub Release. It's the preferred method for shipping a new version. ```yaml .github/workflows/build-mlkit.yml ``` -------------------------------- ### Update Package.swift Checksums and Dependencies Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Recomputes the SHA256 checksum for every zip file in GoogleMLKit/, rewrites the binaryTarget checksums in Package.swift, and synchronizes transitive Google dependencies from Podfile.lock. This is a targeted edit used within the build_all.sh script. ```ruby ruby scripts/update_checksums.rb ``` -------------------------------- ### Create GitHub Release Manually Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/AUTOMATION.md Manually creates a GitHub release with a specified version, title, and notes. This is a prerequisite for using the `upload_release.sh` script. ```bash gh release create --title "Release " --notes "Updated to MLKit " ``` -------------------------------- ### Sync SwiftPM Dependencies from Podfile.lock Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Updates only the SwiftPM dependencies block in Package.swift, synchronizing specific Google libraries (GoogleDataTransport, GoogleUtilities, gtm-session-fetcher, promises, nanopb) from the Podfile.lock. This is a targeted edit. ```ruby ruby scripts/update_package_dependencies.rb ``` -------------------------------- ### Batch Build Multiple MLKit Versions with Shell Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Builds multiple MLKit versions sequentially, automating git commits and tags for each successful build. This script is ideal for processing multiple releases at once or catching up on missed versions. ```bash ./scripts/batch_build.sh [version2] [version3] ... ``` ```bash ./scripts/batch_build.sh 7.0.0 8.0.0 9.0.0 ``` -------------------------------- ### Validate Package.swift Syntax Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Checks the syntax of the Package.swift file. This is also executed in the CI pipeline to ensure the package definition is valid. ```bash swift package dump-package ``` -------------------------------- ### Test Version Check Locally Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md A local test command to verify the functionality of the `check_mlkit_version.rb` script. It should display the current and latest MLKit versions. ```bash # Should show current and latest versions ruby scripts/check_mlkit_version.rb ``` -------------------------------- ### Verify Runtime of Built XCFrameworks Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Performs static checks on the generated XCFrameworks. It verifies architectures, embedded Info.plists, and the symbol table. Use this to ensure the built frameworks are suitable for runtime. ```bash ./scripts/verify_runtime.sh ``` -------------------------------- ### Pin MLKit Wrapper for App Store Submission Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/README.md Use this exact version if you encounter App Store Connect rejections due to Info.plist values in standard releases. This version fixes the regression. ```swift .package(url: "https://github.com/d-date/google-mlkit-swiftpm", exact: "9.0.0-1") ``` -------------------------------- ### Update Podfile and Info.plist Version Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/AUTOMATION.md Updates the Podfile with a new MLKit version and also updates the `CFBundleShortVersionString` in all Info.plist files within the Resources directory. This is a targeted update for versioning information. ```ruby ruby scripts/update_version.rb ``` -------------------------------- ### Add ML Kit Modules to Target Dependencies Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/README.md Specify the ML Kit modules your target needs by adding them as dependencies in your `Package.swift`. ```swift .target( name: "YourTarget", dependencies: [ .product(name: "MLKitBarcodeScanning", package: "google-mlkit-swiftpm"), .product(name: "MLKitFaceDetection", package: "google-mlkit-swiftpm"), .product(name: "MLKitTextRecognition", package: "google-mlkit-swiftpm"), // Also available: MLKitTextRecognitionChinese, MLKitTextRecognitionDevanagari, // MLKitTextRecognitionJapanese, MLKitTextRecognitionKorean .product(name: "MLKitImageLabeling", package: "google-mlkit-swiftpm"), .product(name: "MLKitObjectDetection", package: "google-mlkit-swiftpm"), .product(name: "MLKitPoseDetection", package: "google-mlkit-swiftpm"), .product(name: "MLKitSegmentationSelfie", package: "google-mlkit-swiftpm"), .product(name: "MLKitLanguageID", package: "google-mlkit-swiftpm"), .product(name: "MLKitTranslate", package: "google-mlkit-swiftpm"), .product(name: "MLKitSmartReply", package: "google-mlkit-swiftpm"), ] ) ``` -------------------------------- ### Update Checksums in Package.swift with Ruby Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Calculates SHA256 checksums for built XCFrameworks and updates Package.swift with new checksums, release URLs, and dependency versions. Ensure XCFramework zip files and an up-to-date Podfile.lock are present, and run this after archiving. ```bash ruby scripts/update_checksums.rb ``` ```bash ruby scripts/update_checksums.rb 5.1.0 ``` -------------------------------- ### Update Podfile Version with Ruby Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Updates the Podfile with a specified new MLKit version. This is useful after determining a new version is available and before updating other project files. ```bash ruby scripts/update_version.rb ``` ```bash ruby scripts/update_version.rb 5.1.0 ``` -------------------------------- ### Update Package.swift Dependencies with Ruby Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/scripts/README.md Synchronizes dependency versions in Package.swift to match those in Podfile.lock. It handles special cases for nanopb due to differing versioning schemes between CocoaPods and the SwiftPM repository. Run this after updating Podfile.lock. ```bash ruby scripts/update_package_dependencies.rb ``` -------------------------------- ### Update Checksums for XCFrameworks Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/AUTOMATION.md After building XCFrameworks, this script calculates and updates the checksums for the newly created artifacts. This is crucial for ensuring the integrity of the Swift Package Manager distribution. ```ruby ruby scripts/update_checksums.rb ``` -------------------------------- ### BaseDetectionView Reusable View Pattern Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/Example/IMPLEMENTATION.md A generic reusable SwiftUI view designed for ML Kit vision features. It handles photo library access, camera capture, sample image navigation, and detection processes with loading and error states. ```swift BaseDetectionView( title: String, sampleImages: [String], detectionHandler: (UIImage) async throws -> Void, resultView: () -> Content ) ``` -------------------------------- ### Check for ML Kit Updates via GitHub Actions Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md A daily cron job (09:00 UTC) GitHub Actions workflow that checks for newer ML Kit versions on CocoaPods. If an update is found, it opens an issue. ```yaml .github/workflows/check-mlkit-updates.yml ``` -------------------------------- ### Add MLKit SwiftPM Package Dependency Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/README.md Add this package dependency to your `Package.swift` file to include ML Kit in your project. ```swift dependencies: [ .package(url: "https://github.com/d-date/google-mlkit-swiftpm", from: "9.0.0") ] ``` -------------------------------- ### Check Latest GoogleMLKit Version on CocoaPods Source: https://github.com/d-date/google-mlkit-swiftpm/blob/main/CLAUDE.md Queries the CocoaPods Trunk API to find the latest available version of the GoogleMLKit pod. Useful for tracking updates. ```ruby ruby scripts/check_mlkit_version.rb ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.