[Dev] Reducing the size of an iOS app
Reducing the size of an app is a great way to improving conversion.
For example: A new user finds your app on the App Store, taps the ‘download’ button but the download takes more than 30 seconds. By the time the download has finished, the user is already doing something else and has forgotten about your app.
It’s also important to talk about the celular data limits to download apps. Even though those were removed in iOS 13, iOS will prompt the user if they want to download over celular if the app is over 200MB.
“It’s all about assets”
This statement is usually true. Reducing the app size often comes down to the assets. Let’s take a look one by one the assets:
🌇 Images and .xcassets:
Make sure you don’t add unused assets.
If you have different targets, make sure you only add the assets needed for each target.
Make sure you add the right size of the asset using @2 and @3. Having each @1, @2 and @3 won’t make your app heavier, as Xcode and the App Store will create packages of your app for each device specifically containing only the assets in the required resolution.
If you have a big rich image, consider loading the image using a URL and not adding it into Xcode. You can cache it, so it doesn’t take time to load the next time.
PS: Pile uses Nuke to download and cache images.
🎥 Videos and GIFs:
Avoid videos and GIFs inside your app bundle. Load them through a URL.
If your app needs to have videos, you can host them yourself on a back-end or in Vimeo or Youtube and then extract the .mp4 url (for example, Vimeo URL extractor or YouTube URL extractor) to be able to stream it without a WKWebView embedded.
PS: Extracting the .mp4 url of Vimeo or YouTube might go against their guidelines.
🅰 Fonts:
When investigating why Pile was that heavy (over 90MB), this was actually a surprise for me. Some font files (.ttf or .otf) are quite heavy, and you might want to rethink what font you want to use in your app and how many weights and styles.
The size can affect your app even more if you have app extensions. In Pile for iOS we have a Share Extension and an Action Extension. This meant each .otf or .ttf was copied and bundled 3 times.
Only bundle the needed fonts and weights. Don’t add all the stlyes and weights just because you have them (do you really need Italic? Or BoldItalic? Or the Thin variant?)
Consider using system fonts. This way you won’t have to worry about this problem.
If you use SF Symbols (I use them a lot in Pile and they are a great resource), you don’t need to add the SF font family in the app! Learn more about the SF Symbols in this blog post by AvenderLee.
💾 Enable Bitcode:
It’s enabled on all new apps by default, but if you have an older app project, check it out! Without getting too much into it, having Bitcode enabled allows Apple to recompile your app in the best way possible for each device, significantly reducing download and installed app size. It also allows apple to improve it in a future without the need of a new build from you. Check some more info here.
Just check on your target’s Build Settings if ‘Enable Bitcode’ is true or false.
🤔 For most developers, after going through this list, they should have a much smaller app.
But if your app is not like most other apps, what else can you do?
Check your App Size Report and assess why and what is taking up so much space.
Add On-Demand resources to your app, which means having parts of the app ready to be downloaded on a later stage after app install. It’s very powerful but can get tricky.
Feel free to contact me if you have other and better ways of reducing the app’s size, any questions or feedback!
If you liked the post please try out Pile - and even better, leave a review of the app on the App Store.