Speed Up Xcode Swift Build Times

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.

  1. Go to Firebase Documentation.
  2. 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.
  3. Download the archive. The documentation claims that it's about 200 Mb in size however the one I recently download was almost 370 Mb.
  4. 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



Leave a reply



Submit