What is Bitcode in iOS

You may compile and build iOS app using Swift and/or Objective-C every day, and you've probably you heard of Bitcode multiple times. So what exactly is the Bitcode, as some of you might see the configuration in the build phrase (Target -> Build Settings -> Enable Bitcode):

Bitcode is intermediate language that between frontend (OC, Swift and C) and backend (X86, PowerPC, ARM machine language).

A complete compile includes three main steps:

  • Frontend: compile frontend source code into bitcode.
  • Optimizer: optimize the `Bitcode` based on the configuration, make the code run more efficiently, and reduce the size of app.
  • Backend: as known as CodeGenerator, which convert the ooptimized `Bitcode` into target architecture machine language, such as x86, PowerPC, ARM and so on.


Back to the top question, when Enable Bitcode is set to YES, the optimized Bitcode generated in the Optimizer step will be added to the app, and submitted to App Store. When Apple receives our Bitcode, Bitcode will be recompiled on the server side and generates a more usable version based on each of the platforms, such as the iPhone X, iPhone 11, iPad Pro 2018 and so on in order to shrink the size of the app size and run more efficiently.

comments powered by Disqus