Firebase + Carthage
Make your compile times much faster with Carthage! (Updated to Xcode 11)
Using Firebase with Carthage makes your compile times much faster compared to CocoaPods. That's because with CocoaPods you need to recompile your project including Firebase on every archive or clean build. With Carthage, Firebase is pre-compiled.
Let's start!
Step 1: Download Carthage
We'll download Carthage with Homebrew.
Step 2: Create a Cartfile
Create a Cartfile at the root of your project directory, copy the text below and remove the binaries you don't need.
FirebaseAnalyticsBinary must be included.
After you saved your new Cartfile, run the following command:
Step 3: Copy Firebase to Project
Open Carthage/Build/iOS
on Finder.
Open your project on Xcode and go to your project settings. Select your target from the left, click "General" and scroll down to "Frameworks, Libraries, and Embedded Content".
Drag everything on Carthage/Build/iOS
and drop in "Frameworks, Libraries, and Embedded Content". Make sure to set the "Embed" option to "Do Not Embed".
Step 4: Build Settings
Go to your target "Build Settings", select "All" and search for "Other Linker Flags".
Change its value to $(OTHER_LDFLAGS) -ObjC
Step 5: Build Phases
Go to your target "Build Phases" and select "Link Binary With Libraries". Make sure all that frameworks you added are there and their status is "Required".
Next, delete Firebase.framework
from "Link Binary With Libraries".
Step 6: Add some additional libraries if needed
Run the following command in your project directory:
You'll see all the libraries that Firebase needs. Look at the output and identify libraries that aren't always available (e.g. AuthenticationServices, UIKit, Foundation).
The libraries I needed were "z", "c++" and "sqlite3".
Go back to your target "General", scroll down to "Frameworks, Libraries, and Embedded Content" and the libraries you need.
Click the + icon, and search for lib[name].tbd
That's it! Now you can compile and enjoy the sweet faster compiling.
This article is updated to Xcode 11.
Last updated
Was this helpful?