Dramatically long Swift compilation time Dramatically long Swift compilation time ios ios

Dramatically long Swift compilation time


This issue has been extremely frustrating for me as well. We've tried several of the solutions you've mentioned and none of them worked.

The one thing that made a significant improvement in compilation time is:Turning on the Whole Module Optimization while adding -Onone in Other Swift Flags.
See this - Speed Up Swift Compilation

I'm using Swift 3 with Xcode 8.3.


We improved our compile times a lot by using Carthage instead of Cocoapods to include third party libraries.


It's likely you have code optimisation switched on, whilst this is a must for building your release version, for dev builds it isn't particularly important.

What code optimisation does is exactly what it says, it optimises your code to make the end binary that is produced smaller. It does things such as rename variables/methods to single characters etc... Like I said you obviously want this when submitting to the app store but you might not care if the app is larger whilst developing it.

You can turn off code optimisation for development builds by going to Project Settings > Build Settings, searching 'optim', under Swift Compiler - Code Generation set Optimization Level to None [-Onone] for Debug builds.

This should significantly improve your build times.