Catch up on everthing we announced at this year's Firebase Summit. Learn more

Install Firebase in your Apple app

Swift Package Manager

Starting with v8.0.0 of the Firebase Apple 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.

For Xcode versions 12.5 and higher, Swift Package Manager is the recommended installation method.

Via Xcode

Swift Package Manager support requires Xcode 12.5 or higher.

  1. If migrating from a CocoaPods-based project, run pod deintegrate to remove CocoaPods from your Xcode project. The CocoaPods-generated .xcworkspace file can safely be deleted afterward. If you're adding Firebase to a project for the first time, this step can be ignored.

  2. In Xcode, install the Firebase libraries by navigating to File > Swift Packages > Add Package Dependency…

  3. In the prompt that appears, select the Firebase GitHub repository:

    https://github.com/firebase/firebase-ios-sdk.git
    
  4. Select the version of Firebase you want to use. For new projects, we recommend using the newest version of Firebase.

  5. Choose the Firebase libraries you want to include in your app.

Once you're finished, Xcode will begin resolving your package dependencies and downloading them in the background.

Via Package.swift

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 the 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 dependencies array of that target.

.target(
  name: "MyTargetName",
  dependencies: [
    .product(name: "FirebaseAuth", package: "Firebase"),
    // ...
  ]
),

Product-specific considerations

Some Firebase products require extra integration steps in order to function correctly.

Google Analytics

Google Analytics requires adding the -ObjC linker flag to your target's build settings if included transitively.

Crashlytics

Crashlytics requires you to upload debug symbols.

You can use a run script build phase for Xcode to automatically upload debug symbols post-build. Find the run script here:

${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run

Another option for uploading symbols is to use the upload-symbols 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 parameters.

CocoaPods

Firebase supports installation with CocoaPods in addition to Swift Package Manager.

Firebase's CocoaPods distribution requires Xcode 12.5 and CocoaPods 1.10.0 or higher.Here's how to install Firebase using CocoaPods:

  1. Create a Podfile if you don't already have one. From the root of your project directory, run the following command:

    pod init
  2. To your Podfile, add the Firebase pods that you want to use in your app.

    You can add any of the supported Firebase products to your app.

    Analytics enabled

    # Add the Firebase pod for Google Analytics
    pod 'Firebase/Analytics'
    
    # For Analytics without IDFA collection capability, use this pod instead
    # pod ‘Firebase/AnalyticsWithoutAdIdSupport’
    
    # Add the pods for any other Firebase products you want to use in your app
    # For example, to use Firebase Authentication and Cloud Firestore
    pod 'Firebase/Auth'
    pod 'Firebase/Firestore'

    Learn more about IDFA, the device-level advertising identifier, in Apple's User Privacy and Data Use and App Tracking Transparency documentation.

    Analytics not enabled

    # Add the pods for the Firebase products you want to use in your app
    # For example, to use Firebase Authentication and Cloud Firestore
    pod 'Firebase/Auth'
    pod 'Firebase/Firestore'
  3. Install the pods, then open your .xcworkspace file to see the project in Xcode:

    pod install --repo-update
    open your-project.xcworkspace

Product-specific considerations

Some Firebase products require extra integration steps in order to function correctly.

Crashlytics

Crashlytics requires you to upload debug symbols.

You can use a run script build phase for Xcode to automatically upload debug symbols post-build. Find the run script here:

"${PODS_ROOT}/FirebaseCrashlytics/run"

Carthage

Carthage support is experimental. See the instructions on GitHub for including Firebase in your app via Carthage.

Integrate manually

Firebase provides a pre-built binary XCFramework distribution for users who want to integrate Firebase without using a dependency manager. To install Firebase:

  1. Download the framework SDK zip. This file contains architecture slices for all available target architectures for all Firebase SDKs and thus may take some time to download.

  2. Unzip the file, then review the README for the frameworks that you want to include in your app.

  3. Add the -ObjC linker flag in your Other Linker Settings in your target's build settings.