4 ms·
In swift things have a module-wide visibility by default, that's why it often rebuilds the entire module after a single change that could implicitly affect othe
by ajconway 7y ago
In swift things have a module-wide visibility by default, that's why it often rebuilds the entire module after a single change that could implicitly affect other files. The only viable solution at the moment is to break the project into as many small modules as you can.
- skohan 7y agoIt's also useful to profile your compile times. Sometimes the compiler is spending most of its time on some small sections of code. For instance, I was working on a project where the use of one library constituted 80% of our compile time! The library allows you to declare autolayout constraints using operator overloads (i.e. `foo.top == container.top - 20`) and apparently the amount of type inference was just murdering our compile times. Changing libraries took this project from being awful to work on to quite pleasant.
- ajconway 7y agoSwift also provides a compiler option specifically for debugging long compilation times: "-Xfrontend -warn-long-function-bodies=100"
- gbrhaz 7y agoAh, Cartography. Works great in a small project. We ended up moving to standard anchors for almost everything, with some helper methods to handle things like pinning to superviews.