Table of Contents
•Published: Jun 7, 2022
Yesterday we wrote about the Apple WWDC Keynote on our blog. On the same day of the WWDC keynote, Apple also live-streamed the Apple WWDC Platform State of the Union. Apple focussed software developers often call this “the Developer Keynote”.
The State of the Union session is a more technical presentation with much more detail about what impact Apple’s announcements will have on day-to-day software development with Apple’s SDKs.
Apple started their State of the Union with a recap of the keynote and a short intro on their new Apple Developer Center. Also, some interesting statistics were shared. Apple for example did 100s of live sessions in 11 countries in 5 languages in the previous 12 months. Apple is clearly on a mission to bring together developers and share advice and guidance. Apple as a company has opened up ever so slightly by being more transparent and inclusive to all.
Apple also briefly touched upon their Xcode Cloud offering. Xcode Cloud is now out of bete and available to all Apple Developer Program members. Until the end of the year, you can get free access to Apple’s build infrastructure provided through Xcode Cloud. After that, entry to Xcode Cloud will cost you about 15 dollars at a minimum. Xcode Cloud integrates with all major GIT source control providers and also has a REST based API available allowing you to integrate Xcode Cloud with other services.
Apple clearly divided its State of the Union event into several big focus areas:
- Vision for Platform
- System Experience
- New APIs
So let’s dive in and unpack Apple’s State of the Union event. Oh and Swift Playground 4 was released last fall. (Yes Swift Playground 4 was just a mention during the intro of the State of the Union.)
Vision for Platforms
Apple started the content of the State of the Union with a high-level overview of its vision for the Apple developer platforms. Apple wants a tight integration between its APIs, tools, and platforms. Platforms are watchOS, iPadOS, macOS, tvOS, and iOS. By streamlining the integration of features between platforms Apple aims for developers to be able to focus on what makes their apps unique. If you use Apple’s tools correctly you should have a relatively easy time making things work across Apple’s entire range of platforms. Apple wants to take care of laying out things correctly for you.
Also while Apple is pushing hard for developers to choose Swift and SwiftUI, Apple clearly indicates Objective-C, Interface builder, AppKit and UIKit are not dead and with us for many years. Immediatly followed by a big honking slide stating:
“The best way to build an app is with Swift and SwiftUI.”
If there ever was a message by Apple that this is the year to take the leap into SwiftUI, Apple won’t get much more explicit than this. Start learning SwiftUI people!
Start learning about SwiftUI and Xcode previews. Learn about how to define a UI declaratively, and enjoy the many improvements Apple has done to the current SwiftUI Developer experience.
Swift and SwiftUI has been with us for a couple years now. But it seems 2022 is a big year for Swift and SwiftUI. All the work of the past few years is now coming together in what we think is an enormous pile of improvements to Swift and SwiftUI for software developers. And many of the improvements to SwiftUI are made possible by new features in the Swift language.
Swift and SwiftUI is there to build for all platforms.
Let’s now have a look at what’s in store for Swift and SwiftUI.
As we all know Swift is a strongly typed programming language that works across all of Apple’s devices. On top of that it has an opensource nature with a community producing great initiatives, such as Swift on the Server. This year’s releases from Apple will bring improvements in concurrency, regular expressions, Generics, Swift Package Manager and performance.
Last year Apple introduces async/await and that language feature is now available on all operating systems released in the last 3 years. Apple has actively been backported async/await. On top of that Apple has made improvements to low level data structures by releasing the opensource Async Algorithms package. Low level principles like zip are now available with interfaces supporting async execution. Low level principles like
throttle now make use of a new time unit which makes it much easier to reason about the logic you are implementing.
This year Apple expands upon the Actor model available in Swift by making the concept of Distributed Actors available. Actors allow you to write isolated, concurrency-safe code easily. If you do not adhere to the Actors isolation principles, the compiler will tell you. But, you can now create workloads that cooperate across process boundaries and devices. Actors will become available outside of your process through a pluggable transport mechanism and the Swift compiler ensures correct behavior in distributes environments.
When dealing with strings and detecting patterns in text, you often fall back on regular expressions. And while regular expressions are very powerful, their terse syntax can be difficult to deal with. To make it easier to deal with regular expressions in your code, Apple has implemented a number of enhancements to help you better understand your regular expressions.
First of all the regular expression literal is now syntax highlighted in Xcode and Playgrounds. And, when working with regular expression literals in Playgrounds, the resulting matches of your regular expression are clearly highlighted.
Besides these improvements to the regular expression literal support there’s now also a RexexBuilder class available. With the RegexBuilder you can programmatically construct your regular expression in a way that is often much easier to understand compared to plain regular expression literal syntax. The results and performance are the same, but readability is much improved.
To make Swift easier to understand and write a number of improvements are implemented in the area of Generics. Generics is an important part of your day to day developer experience. And now they will become even more powerful with the
any keywords. By using these new keywords you can shorten the amount of code required and it makes certain tedious tasks easier and more straighforward.
Swift Package Manager
The biggest news for the Swift Package Manager seems small, but it is in fact huge. What’s new is Swift Package Plugins. A Swift Package Plugin allows you to run logic during the build stage of your package. Consider things like linting, formatting and code generations. But also documentation generation is a big one. Probably the biggest Swift Package Plugin many people get to deal with is the DocC Package Plugin because of DocC support now available on the Swift Package Index.
The cool thing avout Package Plugins is the fact that the code executed through it is sandboxed, extends Xcode / Xcodebuild and it works in Xcode Cloud too. The integration of these new plugins in Xcode is also very well done. Look for the type
BuildToolPlugin for more information.
Apple has improved the life of all Swift developers by making sure the Swift Compiler is faster in many areas. Linking is done faster through parallelisation, the launch time of apps has been reduced and async/await runtimes are integrated in more host operating systems, cause less slowdowns when starting a process for debugging.
We expect a lot of the performance highlights will be discussed in all the sessions made available through Apple’s WWDC this week.
The goal of SwiftUI is to create an experience that feels natural on all platforms while allowing for usage of platform-specific behaviors and functionality. It aims to provide an expressive API for quick prototyping, has some strong opinions on writing declarative syntax and does a lot of work under the hood to allow developers to focus on building beautiful user interfaces and creating a delightful experience to users.
This year’s focus was to make adoption of SwiftUI even more easy by incrementally starting to use it inside of existing apps. Also, certain enhancements are introduced to make it more powerful and flexible across all platforms. This affected many areas that we want to quickly touch upon now.
Improvements to app navigation have been one of the most highly demanded features in SwiftUI and Apple introduced an all-new navigation API. The new
NavigationStack view, combined with the
navigationDestination modifier makes the traditional use of
NavigationLink deprecated. It provides new and powerful ways to have programmatic navigation, replacing the entire contents of a navigation stack, and offers better deep link support.
For creating layouts Apple stated that while
VStack are powerful, they can’t cover all use-cases. That is where the new
Grid API comes in. It allows to align grids across multiple rows and columns to more freely align content. On top of that a new costume layout API build on top of that to create even more custom UIs such as flow layouts or even radio layouts.
Another useful addition is a more powerful option to create sheets. While available in
UIKit for a while it’s now also possible to show half sheets with SwiftUI natively. In addition, share sheets are now built on top of the new
Transferable protocol, which is a type-safe API for sharing data.
For making interoperability better with UIKit in general and UICollectionView in particular there is a new option to embed SwiftUI views inside of collection view cells. This provides powerful capabilities such as switch actions and custom background right out of the box with no additional setup or integration steps needed.
One of the big new frameworks that were announced is Swift Charts giving developers a new option to visualise data as part of their apps. It offers bar charts, line charts, heat maps, stream graphs, and many many more. They work great in previews, have excellent accessibility support out of the box, and even animated changes fluidly. And best of all - they are available for all devices and platforms.
There have been some other minor layout improvements for SwiftUI such as the
ViewThatFits view that allows to dynamically show e.g. either an
HStack or a
VStack depending on the screen real estate that is available. The new
NavigationSplitView makes it easy to create a layout with a sidebar that is connected to a
Another nice touch is that it is now even easier to create e.g. a Mac app and an iOS app in a single codebase. There is no need for an explicit target anymore. You can write your adoption code and add device-specific features, such as the new
MenuBarExtra option all by enabling a checkbox within Xcode.
Speaking of Xcode there has been some new functionality briefly mentioned including live previews by default and showing the header of the current function while scrolling through code files in the editor. The preview canvas for SwiftUI views has also been massively re-designed to e.g. show all interface options and a light-dark-mode comparison without the need for creating separate preview items for it.
All in all, Apple provides the option to incrementally adopt frameworks through SwiftUI that powers many of the new capabilities such as the Lock Screen. They finished up this section of the state of the union by stating the following: The best way to build an app is with Swift and SwiftUI.
This statement combined with the announcements they made is a clear indicator that a heavy focus on development and improvements will be headed towards SwiftUI in the future and adoption is recommended.
There have been additions to the system experience for users that is powered by many new APIs and frameworks. These include:
- Lock Screen overhaul
- Collaboration features
- App Intents API
- Authentication updates
Let’s go over all that was mentioned and explained specifically throughout the state of the union.
The Lock Screen gets its biggest update since it was released with options to personalise and customize it more than ever. The biggest addition is widgets on the Lock Screen. They work very similar to complications on watchOS and are also backed by the WidgetKit framework. There are different layout options to it that you can see in the screenshot below, that are circular, rectangular, and inline.
These come together with new WidgetKit families such as
accessoryRectangular that are the same on the different platforms. Together with some new modifiers, like
.widgetAcceptable and new environment variables, such as
widgetRenderingMode it becomes easier to build widgets for all platforms from a single code base. There is also great support for preview options such as changing color modes and showing different variants way more easily.
Part of the updates also include notifications that now stream in from the bottom instead of the top and can be minimized more easily. There is also a new Live Activities API that can stay on top of things that are happening in real-time such as scores in a game or workouts. They can update in real-time avoiding the need to send multiple messages. They’ll be available later, after the initial release but will even bring nice animations to state changes to notifications.
Another big area Apple was focusing on was collaboration with the new Messages Collaboration API. It enables users to start working together on things like documents right from iMessage or FaceTime. Developers can mark their content as collaborative and get easy support with the share view and drag-and-drop. This feature is also coming to iOS, iPadOS, and macOS.
One feature with a large community behind it is also Shortcuts. The new App Intents API allows developers to make their intentions available to the system more easily. It works seamlessly with Siri and Shortcuts and allows creation of App Shortcuts without the need for users to manually add them through e.g. an “Add to Siri” button. It’s an easy upgrade of the older
SiriIntent to the new
AppIntent and even has a
SiriTipView for users to discover them.
There are some huge innovations in the authentication space with the push to get rid of usernames and passwords and use the new PassKey feature instead. This is part of the FIDO alliance and is based on the WebAuthN standard. It can even be used through non-Apple devices through a QR code and is subject to a server integration. It makes credential phishing a thing of the past as PassKeys are linked to an app or website they are bound to and work nowhere else.
Aside from the mentioned new frameworks there have been a ton of new APIs that were introduced and mentioned quickly. Nearly all of them are explained and discussed in more detail in the over 170 sessions that Apple is offering for free throughout the week but a quick glance into what’s new is still interesting to see.
There will be a new find and replace functionality in documents that provides more power-user functionalities to developers. Also, DriverKit will be extended from macOS to iPadOS. This could enable more powerful usages for iPad as it will get the option to support more hardware accessories.
On the watch, the CallKit API is now available and it even includes voice-over-IP functionality so that calls could happen directly and only on watchOS. There have also been bigger changes to the Bluetooth functionality and capabilities for more consistent behaviors.
There have also been improvements to the SKAdNetwork framework. With a huge focus on privacy and security it now offers more details to customers all while becoming more flexible and receiving more capabilities.
ARKit has not seen a new hardware device being presented but there have still been great additions to the framework. That includes ScanKit for scanning real-world environments going together with RoomPlan. It can create a 3D representation of a house or a room with smart detection of things like furniture and kitchen accessories.
As has been announced during the keynote itself MapKit now offers more functionality to developers. Options to use 3D city experience where it is supported and also the Look Around feature gives new ways to present content. There will also be an Apple Maps Server API, that can turn coordinates into addresses and vice versa, offers search, and estimated time of arrival functionality.
There has also been a huge release of a native Swift API called
WeatherKit. It provides a REST API with a lot of details that can range from history data to detailed weather information at any location. It’s available now on all platforms and offers 500.000 calls a month included in the Apple Developer Account, with pricing going up for more calls.
The improvements in machine learning allowed for the new release of the Live Text API in VisionKit. It integrates with text in photos and frozen video frames and makes it tappable. This can now be included by developers through an API and supports 9 languages. The new Data Scanner API makes it easy for developers to allow users to search for content, such as QR codes or bar codes all within the context of their own apps.
The amount of big announcements and new features has not been that large this year. However, the focus seems to have been on refining the existing APIs and making them more integrated into the system and build upon the thought of having feature parity across platforms.
Lock Screen widgets is a good example showing the same API being available on different platforms with WidgetKit powering those as well as complications on watchOS. That makes it easier for developers as they have the same paradigms and principles working across all devices.
The strong focus on collaboration also allows for better user experiences. It’s notable that Apple took existing frameworks and APIs and offered more customizability as well as easier configurability to enable developers to adopt things such as Shortcuts support.
With the lack of big announcements around topics like AR it seems that this year’s iteration of the platforms is focused on improving experiences for developers and making the system smarter for users and offer more convenient experiences across the entire lineup. This is a welcome approach from a developer perspective as it gives us the option to focus on existing content and make it even better.