I have been writing code for roughly a decade. A large chunk of that time has been sitting waiting for my project to compile. It’s a nice excuse to practice sword fighting in the office, but really, deep down. It’s frustrating. It’s so easy to become nerd-sniped when you wait for a long time.
As we integrate Swift into our projects, I’ve been seeing our compile times increase. So, I took some time to look at ways to improve this. The best option, so far, has been dynamic code injection via Injection Plugin for Xcode. In a gist: This means that we don’t recompile and re-launch, instead we inject new bits of code into a running application. This reduced the compile cycle on Eigen from 7 seconds to 1 second.
I took some time over the weekend to try and put together a video showing how I used code injection on a trivial app to create a view controller in code. It covers the technique I’ve started using in Eigen and talks a little bit about how the pieces come together.
Jump to YouTube for the video, or click more for a smaller inline preview.