Starting with v8.0.0 of the Firebase iOS SDK, Firebase's Swift Package Manager support is out of beta and is generally available for use. CocoaPods is not required for Swift Package Manager users.
Swift Package Manager support requires Xcode 12.5 or higher.
If migrating from a CocoaPods-based project, run
pod deintegrateto remove CocoaPods from your Xcode project. The CocoaPods-generated
.xcworkspacefile can safely be deleted afterward. If you're adding Firebase to a project for the first time, this step can be ignored.
In Xcode, install the Firebase libraries by navigating to File > Swift Packages > Add Package Dependency…
In the prompt that appears, select the Firebase GitHub repository:
Select the version of Firebase you want to use. For new projects, we recommend using the newest version of Firebase.
Choose the Firebase products you want to include in your app.
Once you're finished, Xcode will begin resolving your package dependencies and downloading them in the background.
To integrate Firebase to a Swift package via a
Package.swift manifest, you can
add Firebase to the
dependencies array of your package. For more details, see
Swift Package Manager documentation.
dependencies: [ .package(name: "Firebase", url: "https://github.com/firebase/firebase-ios-sdk.git", from: "8.0"), // ... ],
Then in any target that depends on a Firebase product, add it to the
of that target.
.target( name: "MyTargetName", dependencies: [ .product(name: "FirebaseAuth", package: "Firebase"), // ... ] ),
Some Firebase products require extra integration steps in order to function correctly.
Google Analytics requires adding the
-ObjC linker flag to your target's
Crashlytics requires you to upload debug symbols.
You can use a run script for Xcode to automatically upload debug symbols post-build. Find the run script here:
Another option for uploading symbols is to use the
script. Place the script in a subdirectory of your project file (for example
scripts/upload-symbols), then make sure that the script is executable:
chmod +x scripts/upload-symbols
This script can be used to manually upload dSYM files. For usage notes
and additional instructions for the script, run
upload-symbols without any
Performance Monitoring is currently unavailable.