Improve very slow build times in Swift

I have a very large Swift project with approx 300 source files at present. Performing a clean build is very slow, it can take 5+ minutes sometimes. Incremental builds can be faster, but if I modify a class that is used and heavily integrated into the app, then you're looking at the same 5+ minutes even if I just change 1 line in those particular "common" class files.


Does anyone have any suggestions how we can speed up build times?


We have a fair few singleton "manager" classes that are heavily used, would perhaps creating a framework for these be advised?


Any suggestions welcome!

Yeah, breaking things out into frameworks is very helpful. Swift 1.2 helped significantly as well, but you're probably already on that 🙂


Another thing that might help is to reduce the amount of complex type infering you're doing. For example:


let array = ["foo", 1.0, NSNull()]


That isn't super obvious to the compiler, so explicitly saying its of type [AnyObject] will make the compiler be a bit faster.

Improve very slow build times in Swift
 
 
Q