News for hackers. Stuff that matters.
Re:Lightweight API Design in Swift by ajconway on Tuesday November 26, 2019 @05:37AM (#21637091)
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.
Re:Lightweight API Design in Swift by skohan on Tuesday November 26, 2019 @05:58AM (#21637193)
It'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.

Re:Lightweight API Design in Swift by ajconway on Tuesday November 26, 2019 @06:49AM (#21637464)
Swift also provides a compiler option specifically for debugging long compilation times: "-Xfrontend -warn-long-function-bodies=100"
Re:Lightweight API Design in Swift by gbrhaz on Tuesday November 26, 2019 @08:56AM (#21638251)
Ah, 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.