8 tips to speed up your Swift build and compile times in Xcode

Swift is an efficicient language to write but if you’re not careful you can encounter excruciating build and compile times

Josh Gare
5 min readMar 1, 2018
Optimise your Xcode setup along with some code changes and you can bring your Swift development out of the slow lane

There are many different reasons to why Swift build and compile times can take a significant amount of time. The most prominent and common reason is due to type inference. Essentially, the Swift compiler is particularly slow when parsing and compiling simple Dictionary & Array literals due to expensive type checking procedures.

Unfortunately there are occasions where slow compile times are unavoidable, but the good news is, there are some tools and settings changes you can utilise to speed up your Swift compile and build times.

1) Displaying build times in Xcode

First things first, we need to measure your compile times. It’s important to measure to see that the changes suggested in this article are actually having the deisred affect.

You can enable a timer right within Xcode’s UI. This timer is not visible by default but if you run the following in the command line a time will be displayed each time you build your app.

--

--

Josh Gare

Co-Founder at Venn Apps — Full Stack Developer in London — Developing apps since 2008