ABI Stability in Swift

Sajal Gupta
Mac O’Clock
Published in
2 min readMar 30, 2020

The term ABI is quite prominent since the Swift 5 has released.

ABI stands for Application Binary Interface, so what does it mean?

In High-level language we define functions but at the machine level itself has no concept of “functions”. When you write a function in a high-level language like swift, the compiler generates a line of assembly code like _MyFunction1:. So at the binary level interaction happens with other function or libraries through ABI. ABI basically stores all the information of the functions like its code signature (parameters and return type), memory structure and where is the metadata and how to access it.

First thing First, What does Unstable ABI mean?

Unstable ABI means every version of swift has its own copy of the compiled library and the frameworks to interact with other libraries at runtime.

Drawbacks of unstable ABI

  • App size increased.
  • Difficulty to migrate code written in one swift version to another.

Whenever a new swift version released, We had to migrate a lot of things and a lot of code changes in our existing codebase to use the latest libraries. This will cause extra effort for the developers.

Okay Got it, so what is ABI Stability means?

ABI is stable since swift 5 has released. So libraries and frameworks are packaged and linked with the operating system itself: in this case, iOS. ABI will be compatible with every version of Swift.

Advantage

  • Swift version compatibility.
  • Reduced Bundle size.

References

Don’t forget to claps 👏

Follow me on LinkedIn.

--

--

Sajal Gupta
Mac O’Clock

iOS Engineer @Grab Ex- Walmart, Paytm, Tokopedia