From NeXTSTEP to SwiftUI, how Apple has réarchitecturé its systems

AppKit, Catalyst, Cocoa, Marzipan, SwiftUI, UIKit… This list does not inspire you nothing other than the chills ? This is normal : this alphabet soup has thickened over the years. But to understand the importance of the project Catalyst was launched at WWDC 2019, and to consider the consequences of SwiftUI, you will need to know these words. So let’s get back to the basics… and twenty years back.

We are in may 1997. Apple bought NeXT, Gil Amelio was still CEO, but Steve Jobs has already taken over the bar. During the WWDC, it presents the operating system Rhapsody. Built on the ruins of NeXTSTEP, it would retain compatibility with the Mac OS applications through the use of the Blue Box, and would bring the innovations of the NeXT by means of the Yellow Box.

A simplified diagram of the architecture of Rhapsody. The turbulent history of Rhapsody is exciting. Brendan Shanks offers to come back on the WWDC 1997 on his website with the videos and the presentations of the sessions, including one on the basics of Rhapsody.

In the midst of a transition technology, Apple will not close any doors. The kernel XNU developed by NeXT may to be replaced by the NT kernel from Microsoft, or a Linux kernel. The Blue Box is specific to the Macintosh may be replaced by a Windows environment or GNU/Linux, in which case the interface Platinum of Mac OS leaves room for the Windows shell, or an X11 interface. In view of this, the Yellow Box occupies a central place, she who holds the heart of the technology from NeXTSTEP.

A simplified diagram of the architecture of Rhapsody for Mac (left), Linux (middle), and for Windows NT (right). Irony of the story : if the Yellow Box for Windows NT has been distributed to developers, and that the Yellow Box to Linux survives with the GNUstep project, the Yellow Box for Mac OS has never seen the light of day in this form.

The Yellow Box contains, in particular, Foundation Kit, the base layer functions to applications and frameworks, and AppKit, which provides all of the objects to build the interface of an application. Apple refines its choice of technology, under the watchful eye of Microsoft and Adobe, the biggest third-party developers. Rhapsody will make a brief appearance in the form of Mac OS X Server 1.0 in 2000, but leaves it up to Mac OS X, which has a new architecture, as of June 1998 (read : Retro Fcae : Mac OS X is now older than Mac OS).

The Blue Box became the Classic, a virtualization layer of the old Mac OS. Carbon is the link between the old world and the new, allowing to adapt the application’s Mac OS 8/9 to Mac OS X. The Yellow Box became Cocoa, the chocolate, which responds to the coffee of Java, which might well have become the development environment of the Mac. The interface Platinum aging gives way to Aqua, so beautiful ” as we like to lick it “.

A simplified diagram of the architecture of Mac OS X. The layers multiply, but things are clear, because the technology choices are emerging.

After a few years, Mac OS X has reached a certain maturity. Since the memory of Platinum fades, Apple no longer mentions Aqua, or then only in passing. The Classic environment disappears, and developers are invited to use Cocoa rather than Carbon. The roles of the different layers of the system are reorganized and clarified.

A simplified diagram of the architecture of Mac OS X prior to the presentation of the iPhone. Ten years after the acquisition of NeXT, Apple no longer mentions Aqua, and clarifies the presentation of the different layers of the system.

“Yes, but precisely, what is their role ? “ Thank you for asking. The kernel XNU is a core hybrid, based on a free implementation of the micronucleus Mach (OSFMK) and the BSD kernel. This low layer of the system manages access to hardware resources (file system, network, security, hardware) and the drivers (I/O Kit, as well as the inter-process communication (XPC and CPI).

Core OS, literally the ” central system “, manages the configuration of hardware components (System Configuration), identification (Open Directory), the installation of the storage volumes, as well as the devices securing applications (sanboxing, Gatekeeper).

A simplified diagram of the architecture of macOS. You ask why some technologies may appear in multiple layers ? The answer is simple : the system is not strictly organized into layers that are waterproof and interchangeable, and this diagram is only a representation used to capture the functioning of macOS, without, however, describe it precisely.

Core Services includes all of the bricks that allow to build an application, storage (Core Data, Keychain) to the sync (CloudKit) data, through the communication with the network (WebKit, Bonjour) and material resources (Grand Central Dispatch), as well as the installation and distribution of applications. The technologies to create graphics, 2D and 3D, or manipulate the sound and the image, have been recently grouped in their own layer Media.

Finally, the application layer includes all the frameworks to create the visible parts of an application. There are Foundation and AppKit, that remain of brick plants in the design of Mac applications. AppKit allows you to create windows, controls, menus, dialogs ; manage documents and windows ; to control the clipboard and recording of data ; and generally to coordinate the behavior of applications.

Apple has created iOS from Mac OS X, but rather than adapt AppKit to the specific features of touch screens and direct manipulation, it has preferred to develop a ” AppKit to iOS “. UIKit, it is his name, allows you to create views and to react to touch ; to manage documents and data ; and generally to coordinate the behavior of applications.

A simplified diagram of the architecture of macOS (left) and iOS (right). In 2007, Apple was still talking of Cocoa for Mac OS X, and spoke, therefore, of Cocoa Touch for iPhone. If you can still find mentions of Cocoa in the documentation to developers, Apple now prefers to speak of the application layer, in which it excels particularly AppKit and UIKit. This pattern is (necessarily) gearbox : not only the same layer does not contain exactly the same technologies depending on the system, but the same framework can have a different behavior depending on the device. Even if macOS and iOS are much closer these last few years, we can’t (yet ?) talk about a unified system, of which only the application layer would change from one device to the other.

The iPhone was used to store bodies software for the other devices. The Apple TV as the Apple Watch use systems derived from iOS, which incorporate a specific version of UIKit, with elements adapted to the big screen of the tv as the small screen of the watch. In other words, macOS is the only system that does not integrate UIKit. It is precisely the “problem” that the project Catalyst, formerly known as Marzipan, is intended to solve (read : ” Marzipan ” : Apple wants to merge iOS and macOS ? and UIKit on the Mac : the opinion of the developers on the project, Marzipan).

A simplified diagram of the architecture of macOS Mojave and macOS Catalina.

To land on macOS, UIKit has had to learn how to manage multiple windows that can be resized arbitrarily, to respond to the click of a mouse, to fill in the menu bar, or to draw the interface elements, such as AppKit does. But to be clear, UIKit for Mac is still far to match AppKit, and it is likely that he never will.

In its current implementation, it furiously reminds the Blue Box. Go dig through the folder System, and you will find a folder iOSSupport, which is not far from being a version of iOS built-in to macOS ! The project Catalyst is less an adaptation of UIKit to the Mac that integrate with the chaussepied. In the state, it is a bandage on a wooden leg, a way to ease the porting of iOS apps to macOS without solving the underlying problems.

Still it produced some interesting effects. Take iPadOS 13 : if the iPad can display multiple windows of the same application, or to react to the pointer of a mouse, it is thanks to the work carried out on UIKit for the Mac (read : The project Marzipan, a chance for the Mac… and the iPad). From next spring, all iPhone applications must be adapted to the iPad, if they are not yet. Therefore, they can be adapted to the Mac of a check box, based on the project Catalyst.

The dream of universal apps, and an App Store, unified begins to take shape. But the project Catalyst is the first step. The future, it is likely to be a framework common to all systems, which would replace AppKit as UIKit. SwiftUI probably represents the beginnings of this ‘third way’ — that comes this time of the Apple Watch (read : Catalyst today, Swift IU tomorrow, Apple is preparing the future of interfaces).

The future of the systems from Apple ?

One core, one Core OS, the same Core Services, the same multimedia technologies, the same framework application, the same programming language, the same network of distribution… Only the interface will change, depending on whether it appears on the small screen of the Apple Watch or the big screen of the iMac, and why not the virtual screen of the future glasses. The technological legacy of NeXT will have been wound up, but not his ambition.