On March 25 Swift 5 was released. It marked a major milestone in Swift language evolution, mostly by ABI stability. This update is more about building blocks and fundamentals for future version. But it also gives us a few language improvements. Some of them were long-awaited. Also Swift Package Manager wasn’t left untouched.
In this part we will focus on ABI stability and SPM updates, while part 2 will take in-deep tour along Swift 5 language improvements.
So let’s dive in this and: “Say hi to Swift 5”!
Since first news about Swift 5 we heard about ABI stability. But what is this mysterious acronym?
Quick jump to Wikipedia and we got ours answers:
In computer software, an application binary interface (ABI) is an interface between two binary program modules; often, one of these modules is a library or operating system facility, and the other is a program that is being run by a user.
So what that means for Swift and Apple’s world?
Simply, this and all of future releases of Swift libraries will be included into Apple’s platform operating systems: macOS, iOS, tvOS and watchOS. What is more important, compatibility between apps and libraries compiled with different Swift versions will be ensured on binary level. This also means that apps will take a bit less space as standard library will be embedded into operation system. On other hand OS will take more space as those libraries must be put somewhere.
In the example above an app is built with Swift 5, so it will run on every system with Swift 5 library installed. When future release of Swift 5.1 or Swift 6 arrives, the app will also run on those systems. For now app build with Swift 4.2 will not run on Swift 5. It must be built and compiled again for new release.
SE-0236 gives us ability to define minimum required deployment target version in our Package.swift file.
let package = Package(name: “Say Hi to Swift 5”, platforms: [
All supported deployment targets are used in snippet above. Previously we had hardcoded only macOS values.
Target specific build settings proposal, as its name says, allows us to use and specify some target build settings, for example linking C++ frameworks. It’s a small improvement on way to achieve more complex build settings model in Swift Package Manager.
SE-0219 proposal introduces dependency mirror feature to SPM, which allows to refer to alternate source location which *drum roll* mirror the original source. It’s quite useful for cases like caching or availability concerns – if original source is not available or access to it could be slow, it takes mirrored source.
Lastly Swift 5 brings coverage data gathering to the SPM.
That will be all for part 1 of the Say Hi to Swift 5 tour, but don’t worry – there is more to come!
In the next (and final) part we will look at crème de la crème of Swift 5 – language improvements. But before we go further – what do you think ABI stability will bring to Swift? Is it as huge milestone as they say?
We process cookies and make them available to Google Analytics (a service provided by Google, Inc.) to improve the performance of the website, to learn your preferences about using it and to tailor it to your needs. The data will be anonymised before being transmitted. If you do not agree to this, you may disable cookies in your browser. If you do not change your browser settings, you accept the fact that it saves cookies.