mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-09 22:36:01 +05:45
Add support for Swift Package Traits (SE-0450) in Package.swift by introducing a default-enabled "Firestore" trait. Previously, depending on the firebase-ios-sdk Swift package resolved and downloaded Cloud Firestore and its heavy underlying dependencies (gRPC, Abseil, and prebuilt binary artifacts), even if an application only used lightweight Firebase products (such as Auth, Crashlytics, or Remote Config). With package traits, developers can now opt out of Cloud Firestore in their Package.swift (via `traits: []`) or through Xcode 26.4+'s Package Dependencies UI, pruning heavy dependencies and speeding up package resolution while preserving full backwards compatibility: - Define the "Firestore" trait in Package.swift, enabled by default in `packageTraits`. - Gate source and binary Firestore target dependencies (abseil, gRPC, FirebaseFirestoreInternalWrapper, FirebaseFirestoreCombineSwift) on `.when(traits: ["Firestore"])`. - Add `FIRESTORE_TRAIT_ENABLED` C preprocessor macro via target cSettings on `FirebaseFirestoreTarget` and `objc-import-test` to enable conditional compilation for Clang targets when the trait is active. - Provide a clear compile-time `#error` diagnostic in `dummy.m` if an app target links Firestore without enabling the trait. - Gate conditional imports in integration test targets (`swift-test` and `objc-import-test`) so test suites pass both with default traits and with `--disable-default-traits`. - Opt out of default traits in `FirebaseAITestApp` (in project.pbxproj), validating Xcode trait opt-out and avoiding Firestore dependencies for AI Logic integration tests. - Add release notes and Xcode opt-out instructions to changelogs in `FirebaseCore/CHANGELOG.md` and `Firestore/CHANGELOG.md`.
Firebase AI SDK
- For developer documentation, please visit https://firebase.google.com/docs/ai-logic.
- Try out the sample app to get started.
Development
After following the Swift Package Manager
setup instructions,
choose the FirebaseAI scheme to build the SDK.
Unit Tests
Important
These unit tests require mock response files, which can be downloaded by running
scripts/update_vertexai_responses.shfrom the root of this repository.
Choose the FirebaseAIUnit scheme to build and run the unit tests.
Updating Mock Responses
To update the mock responses, create a PR in the
vertexai-sdk-test-data
repo. After it is merged, re-run the
update_vertexai_responses.sh
script to download the updated files.