Swift 5 ABI Stability

Learn why ABI Stability is important?

Aaina jain
May 11, 2018 · 2 min read
Image for post
Image for post

Introduction:

ABI stability enables OS vendors to embed a Swift Standard Library and runtime in the OS that is compatible with applications built with Swift 5 or later.

What is ABI?

ABI stands for Application Binary Interface. At runtime, Swift program binaries interact with other libraries through an ABI. It defines many low level details for binary entities like how to call functions, how their data is represented in memory, where metadata is and how to access it.

What is ABI Stability?

ABI stability means locking down the ABI to the point that future compiler versions can produce binaries conforming to the stable ABI. It enables binary compatibility between applications and libraries compiled with different Swift versions.

Earlier, Swift was not ABI stable, so each binary was bundling its own version of the Swift Dynamic Library. If you open an .ipa you can find swift standard libraries (.dylib) in SwiftSupport or Frameworks.

Suppose Apple music is using Swift 3.2, so it bundles Swift 3.1 Dynamic Library inside but the Notes app is using Swift 4.0, so it bundles Swift 4.0 and it’s 4.0 ABI.

Now Swift 5 is ABI Stable, Swift will be embeded within the iOS Operating System and it’s ABI will be compatible with every version of Swift. i.e Apple Music is using Swift 5.0, but Notes app is using Swift 5.2, and both are consuming Swift ABI embedded in the Operating System.

Why does ABI Stability matter?

  • Reduced Bundle size: Size of your application will decrease because you will no longer have to include the Swift standard library in your Frameworks folder.

References:

You can always reach me on: Linkedin or Twitter

Swift India

Swift Developer Community in India 🇮🇳

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store