iOS App thinning (reducing size of the app)
App Thinning was introduced with Xcode 7, with the main emphasis on tailoring the App delivery to the capabilities of the user’s particular device, with minimal footprint which in turn leads to decrease in the app size.
The three components of app thinning : slicing, bitcode, and on-demand resources of these slicing and bitcode are the most relevant for non-gaming related apps.
Slicing is the process of creating and delivering variants of the app bundle for different target devices. App Slicing delivers only relevant assets to each device (depending on screen resolution, architecture, etc.) In fact, app slicing handles the majority of the app thinning process.
When you’re ready to submit the app, you upload the .IPA or .App file to iTunes Connect, as you typically would (but must use Xcode 7 or above as it contains support for app thinning). The App Store then slices the app, creating specific variants that are distributed to each device depending on its capabilities.
While slicing is done automatically at the time of download from App Store, the only criteria to be satisfied is that for resources to be sliced you must use the asset catalog(*.xcassets)”.
Bitcode is somewhat abstract, but in essence it is Apple’s new way of optimising apps before they’re downloaded. Bitcode makes apps as fast and efficient as possible on whatever device they’re running. Bitcode automatically compiles the app for the most recent compiler and optimises it for specific architectures (i.e. arm64 for 64 bit processors such as the iPhone 6s and iPad Air 2).
Bitcode makes downloads smaller by eliminating optimisations that are made for different architectures and rather only downloads the relevant optimisations.
Enabling bitcode is optional for iOS currently but will be compulsory in the near future.
We have to “Enable Bitcode” in the Build Settings:
Figure: Shows how to enable bitcode in XCode
We face issues with bitcode when using third party libraries and dependency managers (CocoaPods, Carthage) as some third party libraries may not be supporting bitcode. In this case disable bitcode, but now most of the popular libraries support bitcode.
App size differences
Here are the App sizes comparison of one of our App’s latest build:
Figure: Without App Thinning
Figure: Without Bitcode But Slicing enabled
Figure: With Slicing and Bitcode
App Thinning thus reduces the size by over half!(in most cases)
Knowing how important download size is especially for those apps which just cross over-the-air limit, this is very significant.
To find out more about App Thinning — You can find Apple Documentation here.
Originally published at blog.inapptext.com on June 23, 2016.