How to decrease build times / speed up compile time in Xcode?
Often, the largest thing you can do is to control your inclusion of header files.
Including "extra" header files in source code dramatically slows down the compilation. This also tends to increase the time required for dependency checking.
Also, using forward declaration instead of having headers include other headers can dramatically reduce the number of dependencies, and help all of your timings.
How to improve build times with Firebase in Xcode
If you're optimizing for build time, I suggest that you integrate Firebase as a binary framework rather than an SPM dependency.
I used to have similar build time issues with Firebase on relatively small apps. While incremental build times were tolerable, cold builds on CI were painfully long and that was the turning point for me. After integrating Firebase as a binary .xcframework my cold build times on CI dropped from 30-45 minutes down to 5 minutes.
- Go to Firebase Documentation.
- In the section that explains how to integrate it without a dependency manager you'll find a link to a .zip archive containing all Firebase frameworks.
- Download the archive. The documentation claims that it's about 200 Mb in size however the one I recently download was almost 370 Mb.
- Follow the instructions in Readme.md that you'll find inside the archive.
It's a bit painful to set it up for the first time and is a bit annoying to update Firebase manually from time to time, but for me the drop in build times was totally worth it.
Related Topics
Swiftui Views with a Custom Init
Initialization of 'Unsafemutablerawpointer' Results in a Dangling Pointer
How to Mock Uiapplication in Swift
Xcode 6 Beta/Swift - Playground Not Updating
Get Path to Swift Script from Within Script
Exclude Swiftui Previews from Code Coverage
Skaction Runaction Does Not Execute Completion Block
Mock Third Party Classes (Firebase) in Swift
How to "Append" to an Immutable Dictionary in Swift
Swift Generics: Cannot Convert Value of Type to Expected Argument Type
Sorting Nil Dates to the End of an Array
Creating Gif Image Color Maps in iOS 11
Swift: Function with Default Parameter Before Non-Default Parameter
iOS 13 Strange Search Controller Gap
Why Does a Public Class/Struct in Swift Require an Explicit Public Initializer