Apple so seldom pre-announces major changes in macOS, except at its annual WWDC which is still over three months away. But for once, it has officially informed us of a major change which is coming in macOS Mojave 10.14.4, probably due in around a month’s time, at the end of March.
This isn’t something that users will notice immediately, but is the culmination of nearly a decade of heavy investment and the efforts of many of the finest software engineers: Swift 5.0. Before you abandon reading this thinking it’s relevant to those writing apps, not those using them, please bear with me: this will change your Mac, because it marks the moment that Swift becomes part of macOS.
Peek inside any app written in Swift – such as one of my recent free apps from Downloads above – and you’ll see a folder called Frameworks, which accounts for much of the size of the app, typically over 11 MB. It contains a load of dylibs, providing the glue between the app and macOS. Currently, no app written in Swift can run without this support, and it has to be duplicated in every single Swift app which you have on your Mac, even those which are still mostly written in Objective-C.
With the release of macOS 10.14.4, and Xcode 10.2, apps written in Swift 5.0 won’t need those frameworks (except for compatibility when running on older macOS), as the ‘glue’ will be part of macOS, delivered with each new system update.
This is because, until now, Swift has been changing so rapidly that each version required slightly different ‘glue’. The interface between its compiled apps and macOS, known as the Application Binary Interface, or ABI, has had to change as the language and its features have changed. Swift 5.0 introduces a stable ABI, across macOS, iOS, watchOS and tvOS, so that an app built for one version of Swift will be able to work with libraries, particularly those provided by the operating system, built with another version.
In macOS 10.14.4, its iOS and other siblings, Swift support becomes an integral part of all Apple’s operating systems, not something which has to be provided in every app using Swift, and system libraries (frameworks) can be built in Swift and remain compatible too.
This doesn’t mean that only apps developed in Swift will run on the Mac. Its original primary development language, Objective-C, remains very popular among many of the best developers, and there’s no reason that should change. Apple still has projects like FoundationDB, which forms the backbone of CloudKit, which don’t have Swift support yet. But those who are switching to code in Swift should be able to bring you increasing benefits from that choice.
Neither does Swift eliminate bugs, sadly. There is, though, a very real prospect that Apple might find its way to rewriting some of the creaky old frameworks and sub-systems on which macOS relies – which provide support for important features like keychains. With those revisions, tighter integration with apps written in Swift is almost inevitable.
You should also expect Swift 5.0 apps running on 10.14.4 and later to launch faster, deliver you better performance, and use less memory than they have in the past.
Apple has long preferred to have its own development language. Back in the days of Classic Mac OS, it was Object Pascal. After a brief affair with C++, when Mac OS X came along, many were surprised that it brought with it Objective-C from NeXT, a language developed in the early 1980s. Neither platform-specific as Object Pascal was, nor popular across a wide range of platforms, it has been little-used outside NeXT and Apple.
Swift’s huge market advantage has been its popularity on iOS. Originally a proprietary in-house project, Apple opened its source at the end of 2015, and it now has a significant following on Linux as well. It does have language features which make it less prone to some of the notorious errors to which code written in C-family languages are vulnerable.
In releasing Swift 5.0 at this stage of the Mojave cycle, Apple is preparing the way for 10.15. Don’t be surprised if that brings further changes built on this important foundation, such as new and re-written frameworks and libraries, on both macOS and iOS. Those could be very important for what’s coming this autumn/fall.