The year is 2040, and our newest MacBook M30X processors can compile large Swift projects perceivably instantaneously, sounds pretty amazing, right?
Except, compiling the codebase is just part of our iteration cycle. Other ones include:
- restarting it (or deploying it to the device)
- navigating to the previous location where you were in the App
- re-producing the data you need.
It doesn’t sound too bad if you have to do it once. But what if you are like me and, on a typical day, do between 200 - 500 iterations on the codebase? It adds up.
There is a better way, embraced by other platforms and achievable in the Swift/iOS ecosystem. I’ve used it for over a decade.
Do you want to save up to 10h work per week, starting today?
No matter how experienced we are, we are bound to make mistakes in our work.
This simple fact is one of the reasons why Code Reviews have become the cornerstone of software engineering processes around the world.
Part of my job is building teams and establishing best practices for them to operate efficiently and collaboratively.
But team practices shouldn’t just be coming from an individual, which is why I first interviewed a bunch of our engineers at The Browser Company around what is the goal of PR’s and Code reviews.
In the spirit of giving back to the community, we’ve decided to share those practices.
We define ego as a person’s sense of self-importance. It’s an attribute that contributes to building up your identity and figuring out what you want in life.
But left unchecked, ego can lead to arrogance and ignorance.
I’ve worked on TCA projects for more than a year on projects of all sizes: from smaller projects like my indie Sourcery Pro, through the New York Times project, to a truly large codebase, a completely new browser for The Browser Company.
TCA has been working great in all of them, but one thing that I was missing was an easy way to debug state changes, as the official debug higher-order reducer doesn’t play well with large app states.
So I thought: let’s create an interface that will not only deal with larger states, but also offer us a way to filter actions with ease:
Two weeks ago I’ve released Sourcery Pro, the most powerful Xcode extension that exists.
If you still didn’t check it out, you really should as it can save you 100+ hours by letting you automate a lot of repetitive code in your projects, from writing mocks through SwiftUI and Snapshots.
Now let me tell you a bit about what Xcode extension offer and a couple of ideas for what Xcode team could add in future releases, to make tools like Sourcery Pro more powerful.
A lot has been written about improving Swift compile times, but the compiler and linker are just part of the equation that slows down our development cycle.
Most projects leverage great 3rd party tools like SwiftLint, Sourcery, SwiftGen, SwiftFormat and many more. Leveraging those tools is the right thing to do but we have to be aware that all of those tools come with some time delay for our build -> run development cycle.
We often set those tools to run as build-phases which means they run each time you attempt a build but none of those tools need to be run each time we build.
Even tools that generate code we need for our projects like Sourcery or SwiftGen don’t need to be re-run unless we made changes in very specific parts of the application.
As an example New York Times main application leverages a lot of 3rd party and internal tooling, the total time all the tools take is 6s on my (powerful) machine.
Only 6 seconds or as much as 6 seconds?
Let’s put this into context:
I build a project between 200-400 times on an average workday.
Let’s assume 90% of the time we don’t need to run those tools with each build.
We have 30 iOS developers working on the main app
Lower limit: 200 * 6s * 30 * 90* => 9 hours wasted per day
We are wasting 45 hours per week, if we can improve that it’s almost like hiring a new full-time developer, except it’s free.
Let’s look at how we can improve this with a process change a dash of bash shell programming.