The most significant change to Apple’s developer ecosystem this decade has been the introduction of the Swift programming language – and we’ll probably see the next big change come during this year’s WWDC with the introduction of third party UIKit apps on the Mac.
As for Swift, the new language was announced at WWDC 2014. With contributions from both Apple engineers and the open-source community, it has seen constant updates and is now in version 4.2.1.
An important aspect of Swift that has been affecting users since its first version is that its application binary interface, or ABI, is not stable. What that means in practice is that Apple can’t include the Swift language support in its operating systems, because an app written with Swift 3 won’t work with the language support binaries for Swift 4. The solution to that is to include the Swift language libraries inside the app bundle that gets downloaded from the App Store, increasing the bandwidth and storage required by the app.
That’s finally changing for Apple and Swift soon…
With Swift 5, the language becomes binary compatible. The new version is included in iOS 12.2, tvOS 12.2, watchOS 5.2 and macOS 10.14.4, all of which are currently in developer beta. This means that, when the new versions of Apple’s operating systems become available to the general public, apps published to the App Store which use Swift 5 are going to be significantly smaller for users running the new operating systems.
Another benefit will be faster launch times, since every dynamic library that’s used by an app increases its launch time slightly, but the libraries included with the operating system are cached in memory and shared between all apps. Limitations associated with Swift will be removed overnight in a single update.
But just how much savings are we talking? We downloaded some apps from the App Store and checked how much space was taken by the Swift libraries, here are a few examples:
Apollo for Reddit has a size of 35.7 MB which includes 7.5 MB of Swift libraries. When updated to Swift 5 in iOS 12.2, the app size will be reduced by more than 20%, down to under 30 MB. PCalc has a size of 86.8 MB, including 7.5 MB of Swift libraries. When updated to Swift 5, the app size will be reduced by 9%, down to under 80 MB.
Chirp which brings Twitter to the Apple Watch has a size of 28.8 MB and includes 11.6 MB of Swift libraries. When updated to Swift 5, the app size will be reduced by more than 30%, down to under 20 MB. This is the app with the most significant savings from the ones we calculated because it includes an Apple Watch app written in Swift, which has to include the Swift libraries for watchOS.
The sizes and savings vary according to the device. We used the size of the apps on an iPhone XS Max as a reference, but considering a device with many apps installed, the savings can add up.
Of course, this assumes developers will adopt Swift 5, but most apps written in Swift are actively maintained and the migration is not too difficult. The new version of the language also includes a mode that is compatible with code written for Swift 4.2, which will make the migration a lot easier for developers with large amounts of code to migrate.
All users have to do to take advantage of this is to update to iOS 12.2, tvOS 12.2, watchOS 5.2 and macOS 10.14.4 when they become available, and wait for developers to update their apps. All systems are currently in beta for developers. Apps built with Swift 5 and released to TestFlight already include the space savings for those who are running the betas.
FTC: We use income earning auto affiliate links. More.