Here are 8 tips to optimize your iOS app 📱

Hi 👋

Last week marked the 3 year anniversary of my YouTube channel 🥳

So I wanted to take this opportunity to share with you that I’m really happy with how my content creation has been going recently!

These past months I’ve introduced several new formats that have been received very positively, and that has been a real motivation booster 🤗

You’ve also probably noticed that I've been working with quite a few sponsors recently: this is really positive because it gives me the means to keep creating more ambitious (and free) content!

As I start my 4th year as an iOS content creator, I wanted to thank you all for your support!

I’ve got lots of ideas for some cool new content that will be coming over the next months: I hope you’ll enjoy it 😌


Last week I’ve released a video that I was really excited about, because it focused on a topic that I had never really covered on my channel until then: How to optimize the performance of iOS apps!

As you can imagine, this is a topic that requires deep technical knowledge in order to provide good actionable advice, so for this video I partnered with Emerge Tools, who specializes in performance optimization tools.

The result of that collaboration was this video, where Itay Brenner (an engineer at Emerge Tools) shared 8 tips to optimize your iOS apps:

The video was received very positively, so I figured that it could be worth it if for this week’s email I wrote an outline of all the tricks Itay has shared!

#01 – Stripping Binary Symbols

To put it shortly, binary symbols are extra information that can be contained in binary frameworks, but that is not needed to run the app in production.

But the thing is that, in addition to not being needed in production, when these symbols are there they can take up some room. A lot of room actually, because in large apps they can account for more than 20% of the binary size!

So if your app does ship binary symbols to production, you’re probably gonna want to learn what are the steps to remove them 🚮

#02 – Sharing Code and Assets

When adding a new target to your Xcode project, for example to implement a Widget or an Extension, it’s very easy to mistakenly embedded the same compiled code twice.

Or even worse: embedding large assets, like images or videos, twice!

If you’ve made that mistake, don’t worry: Itay will explain how it can be solved by sharing code and assets across targets.

#03 – Optimizing Assets

Even when you’re including assets only once, there’s still room for progress!

Because it’s also very easy to embed assets that are not optimized for iOS apps, meaning that they are much bigger than they could actually be.

But no worries, because once again there are tools out there that will make it easy to optimize your assets and save precious resources 👌

#04 – Keep the Main Thread Light

We know that if we want our app to run smoothly, we should avoid running costly computations, like decoding a large JSON, on the main thread.

But did you know that in some cases it’s not that simple?

For instance, how do you deal with decoding a large image when you’re not allowed to use a UIImageView outside of the main thread?

As it turns out, there’s a solution for that!

#05 – Prefer Static Dispatch

In programming languages, convenience tends to be achieved at the cost performance.

One example is dynamic method dispatch, which allows us to use polymorphism but comes at the cost of extra code look-ups at runtime.

However, there are ways to mitigate this performance cost, including a very interesting compile-time setting that can do wonders 🫢

#06 – Understanding Package Managers

Not all package managers share the same advantages and drawbacks, so it’s also good to have an overview of the specific features they provide!

#07 – Optimizing CoreML Models

If your app uses CoreML, there’s a good chance that ML models are among the largest assets bundled with your app.

As it turns out, it’s possible to reduce the size of the models, through a process called “quantization”.

(But this comes at the cost of loosing precision on the predictions, so make sure to discuss it with your ML colleagues before you ship it!)

#08 – Never Stop Improving

Optimizing the performance of an iOS app is more than a one-time thing: it’s a continuous effort to regularly monitor key indicators (like binary size or startup time) and dedicate the appropriate effort to keep them at an acceptable level 😌

Conclusion

I hope you’ve enjoyed this series of tips!

If you want to learn more about optimizing iOS app performance, I recommend you have a look at Emerge Tools’ blog: they write articles that deep dive on topics that I’ve rarely seen covered anywhere else!

That’s all for this email, thanks for reading it!

If you’ve enjoyed it, feel free to forward it
to your friends and colleagues 🙌

I wish you an amazing week!

❤️

Previous
Previous

Bad practice: not using Phantom Types

Next
Next

Here’s how you can learn Swift Concurrency in 2 hours 👩🏽‍🎓👨🏻‍🎓