When asked to describe this year’s WWDC, words like “packed”, “massive”, and “overwhelming” come to mind. It seems that Apple has announced multiple years worth of development. The following are some of the most prominent features, but rest assured that this article could easily be ten times as long if one was to dig beneath the surface.
SwiftUI is a new framework that unifies UI development across Apple’s platforms. While it isn’t exactly “write once, run anywhere (on Apple’s platforms),” it gets quite close. UIs built with SwiftUI will work on any Apple platform just fine, but developers will likely want to tweak certain aspects of the UI to make better use of the platform’s strengths.
Apple’s current UI frameworks — AppKit, UIKit, and WatchKit — construct views imperatively, using a sequence of commands to first create components and then configure and manipulate them. On the other hand, SwiftUI is a declarative framework, describing the view hierarchy and rendering only at the behest of the system. This approach is similar to how layout is described using HTML, except here it’s done in Swift. Additionally, views are only re-rendered when needed, such as when the data changes, or the window is resized, ensuring optimal performance.
Fully customisable, interruptible, and reversible animations are built in, as are sophisticated ways of controlling sizes, positions and alignments, down to the baselines of text across view hierarchies. While this level of control was previously possible, it required the use of multiple auto layout constraints, or many lines of manual code.
What is fascinating about SwiftUI is how many things are free — in most cases, accessibility just works. View coordinates are automatically rounded to the nearest pixel (not point) to prevent aliasing. Spacing, while entirely in the hands of the developer, will default to platform-appropriate values. Support for Dynamic Type (where the user can adjust the font size of the UI) and Dark Mode in iOS 13 and macOS Catalina require no extra work.
SwiftUI takes full advantage of features in the recently announced Swift 5.1, such as builder closures, return omission, and property wrappers. The last one is used to support bindings through custom attributes — a first on iOS since its inception.
Since all of Apple’s sessions before Friday focused on building standard-looking screens (think the iOS Settings app), we were at first concerned that the framework would limit us in customising the appearance of our UI. As we got to work with the beta, though, we were able to fairly easily create entirely non-standard views. I’ve put together a very basic implementation of the 15 Puzzle on Github. It works on iOS, macOS, and watchOS (not currently supported by React Native) — all with the same code, supporting platform features such as multitasking, Dynamic Type and Dark Mode out of the box.
Continuing with the declarative theme that Apple seems to have embraced this year, they have come up with a new framework for asynchronous event handling called Combine.
It is quite similar to the existing open source RxSwift library. However, it supports features like backpressure and typed errors and doesn’t even require dispose bags. If these benchmarks are to be believed, it is also much faster than RxSwift.
iPad multi-window app support
In iPadOS (equivalent to iOS 13, but on iPads), Apple has made it possible for a single app to spawn multiple windows.
While some modification is required on the part of the developers, it also comes with a great amount of control over exactly what the app supports. Essentially, there are two different ways to use multi-window support. One is to have each window entirely independent, which works great with document-based apps or browsers. The other way is to have specialised windows for different tasks — such as creating a composition window in Mail, or looking at a detail of a single note in Notes.
Apple cautions that there are types of apps for which this multi-window model doesn’t make sense. We believe the Kiwi.com iOS app could take advantage of this, though — for example, a user might want to compare multiple search results before deciding which route to book.
Sign in with Apple
One feature with an almost immediate impact is Sign in with Apple, which allows users to use their Apple IDs to log in instead of social network accounts. Since the vast majority of users of Apple’s platforms are logged in at all times, users don’t need to enter any passwords and can instead just use the built-in biometrics (TouchID, FaceID) to authorise the login. Deep integration in the system and iCloud syncing means that once a user signs in this way on one device, they can automatically be offered to also sign in on their other devices. In the interest of privacy, the user can opt to use a disposable email address instead of their real one. Emails will be forwarded to the real address for as long as it is used, but the fake address will be destroyed after logout.
Why will this have an immediate impact? As soon as iOS 13 comes out this autumn, apps that currently offer social network logins will need to implement Sign in with Apple as well, or face App Store rejection. The Kiwi.com app currently offers login through Facebook and Google accounts in addition to email, so it falls into this category.
There are also some great improvements to the Xcode IDE. With version 11, there are new options for organising panes and windows, a mini map of source files, new support for rendering documentation and MARKs, and many other quality of life improving features (spellcheck anyone?).
Bigger features include Swift Package Manager integration — which will hopefully replace our reliance on CocoaPods — , the ability to quickly toggle environmental variables such as light/dark mode, dynamic type, and other accessibility settings while the simulator is running. And most importantly, it includes the ability to instantly preview UI written in code, which previously required complicated setup in a Swift playground.
Overall, this was an excellent year for Apple developers. In time, the new features of SwiftUI, Combine, and Swift Package Manager integration should bring significant productivity increases, while advances in CoreML, natural language processing, and parameters in Siri shortcuts already enable new use cases for the Kiwi.com app. The new multitasking support on iPads, collaborative AR, and RealityKit redefine what’s possible on mobile, or indeed, any device.
Would you like to join us in making the best travel app on the App Store? Check out our open positions.