How to speed-up Cloud Firestore Xcode builds on your Flutter apps
One long-standing issue with Cloud Firestore is that Flutter Xcode builds take a long time, especially on CI environments. This is because the Firestore iOS depends on 500k lines of mostly C++ code, that are compiled from scratch as part of the Xcode build.
Fortunately, a solution is now available and documented here:
To speed up your build times, you can use invertase/firestore-ios-sdk-frameworks, which contains precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK release downloads.
To take advantage of this, add this line inside your
target 'Runner' do block in your Podfile:
# ... target 'Runner' do pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '6.26.0' # ... end
Note: the first time you try this, you may get this error log:
[!] CocoaPods could not find compatible versions for pod "FirebaseFirestore": In snapshot (Podfile.lock): FirebaseFirestore (= 1.11.2, ~> 1.11.2) In Podfile: FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `6.26.0`) None of your spec sources contain a spec satisfying the dependencies: `FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `6.26.0`), FirebaseFirestore (= 1.11.2, ~> 1.11.2)`. You have either: * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.
This is solved by removing
ios/Podfile.lock and rebuilding.
You're welcome! 😎