SwiftUI ’22 in Numbers (and a few Charts)

After posting this article, I realized that due to a bug in SourceKit, the numbers here are a bit underestimated. They do not include the Charts API types, methods and properties. SourceKit is currently crashing when trying to open the interface file of the Charts API. I will update the numbers as soon as sourcekit is fixed.

One more year, the WWDC has come and gone. And so it is time for me to start writing articles on the exciting changes and additions it has left us. Every year, in order to better plan for the updates of the Companion for SwiftUI app, my first step post-WWDC is to go through the entire API first. This will let me see how much work I have ahead.

This is a great opportunity for me to translate all these changes into numbers, and since this year SwiftUI adds a new Charts API, why not take the chance to plot those numbers too.

Today we will also look to the past. We are now starting the fourth year in SwiftUI history, so I think it is a good time to put those numbers into perspective and see how much the API has evolved.

New types

The following chart shows the number of types that are new, deprecated, or already existed but are now extended to a new platform (e.g., Tables where only available on macOS, but now they can also be used with iOS).

TypeAdded Deprecated Extended
Protocols509
Views2024
Shapes1
Property Wrappers
Scenes2
Environment Values2012
Style Protocols512
Style Types1954
Total72921

Although these numbers don’t look too impressive, when we look deeper, we find out that the existing views and protocols have exploded in number of methods, properties and initializers. See below.

New initializers, methods and properties

Added Deprecated Extended
Initializers1931538
Instance methods162632
Instance properties46512
Total4012682

The Year Of…

Every WWDC brought updates in multiple areas. But each had its highlights:

WWDC ‘2019: The year SwiftUI was born, need I say more?

WWDC ‘2020: Lazy grids, better scroll support, a new SwiftUI life cycle for our apps, Scenes, Widgets, matchedGeomtryEffect.

WWDC ‘2021: Audio graphs, tables for macOS, timeline view, async images and other async features, search, enum-like styles, canvas view.

WWDC ‘2022: Charts, sharing, a badly needed navigation view improvement, an exciting new layout protocol, tables arrived to iOS, improvements for UIKit/AppKit integration, a new window scene, a new menu bar scene, eager grids (as opposed to lazy grids), focus sections now supported on macOS.

WWDC ‘2023: If I only new… 🔮

Evolution of SwiftUI in Numbers

The following charts show how many types, initializers, methods and properties where added every year:

The same charts as before, but this is showing the accumulated totals (existing and new) each year:

Wrapping Up

After looking at those numbers, it seems we have some work to do, so I better get started. But first, since it feels weird posting without some code, here is a gist with all the SwiftUI charts from this article. The code is not too elegant, as I wrote it while learning, gathering data and writing this post. Now, with the disclaimer out of the way, here’s the link.

Very soon I will be posting, same as last year, a curated and categorized list of the Q&A’s of the SwiftUI Digital Lounges. Sometimes, the best questions are those we did not think to ask… Stay tuned!

1 thought on “SwiftUI ’22 in Numbers (and a few Charts)”

  1. I am really looking forward to your analysis – the examples are always so well done and have been a source of inspiration and I find myself continually referring back to them. Bravo!

    Reply

Leave a Comment

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close