Skip to content

My Top 3 Wishes for WWDC 2022

With Apple announcing WWDC week for June 6–10 this year, let’s dive into what new frameworks, APIs, and tools I hope to see unveiled and what using them might feel like with examples.

My Top 3 Wishes for WWDC 2022

✨ 2023 Update: I’ve added 3 more wishes in this successor article.

Each year, there’s this very special time, when a specific group of people is making wishes and getting their hopes up for all sorts of things. Some share their wishes with others, some just keep them secret in their heads to not get too disappointed if not fulfilled. I used to be in the latter group, but this time I’d like to share my wishes to improve the probability of them coming true — if not this year, then maybe the next. After all, Santa might be listening.

I’m going to skip any of the obvious topics that are on top of almost every iOS developer’s list, such as a more stable Xcode, a more bug-free Swift, a more complete SwiftUI, or more reliable SwiftUI Previews. Let’s get started!

#3: Importing App Icons in all sizes from One Image

Problem

Every app is required to have an app icon. Xcode requires us to provide the app icon in dozens of different sizes though, without any support to resize them. While there are many apps & tools to help get there, only a few of them support the latest set of sizes as Apple likes to add new sizes over time. This is an unnecessary obstacle for new developers just starting.

The temporary App Icon set of my Open Focus Timer app

But they are all generated as Optional types in Swift code anyhow. This and the whole NSManagedObjectContext API design feels quite outdated and not very “Swifty” (as in “not safe”). It’s time for something new!

Solution

Apple could introduce a new Swift-only framework (like SwiftUI) named something like SwiftData which provides a high-level API to define and manage persistable models. Defining a model could look something like this:

import SwiftData

actor Category: PersistableObject {
  @Persisted
  var colorHexCode: String

  @Persisted
  var iconSymbolName: String

  @Persisted
  var name: String

  @PersistedRelation(inverse: \CategoryGroup.categories)
  var group: CategoryGroup
}

For models to store in iCloud, you’d need to prepend distributed in front of actor. Normally accessing any property of an actor would require the awaitkeyword, but some magic property wrappers could simplify this to:

import SwiftUI
import SwiftData

struct CategoryView: View {
  @PersistedObject
  var category: Category

  var body: some View {
    Label(
      self.category.name, 
      systemImage: self.category.iconSymbolName
    )
    .foregroundColor(
      Color(hex: self.category.colorHexCode)
    )
  }
}

And writing to an actor property isn’t possible from outside, but the @Persistedproperty wrapper might have some Binding magic to allow this:

import SwiftUI
import SwiftData

struct CategoryView: View {
  @PersistedObject
  var category: Category

  var body: some View {
    TextField("Name", self.category.$name.bind())
  }
}

I have to admit, I have not used Actors in practice yet, so forgive me if some of the above examples don’t make any sense. But I have a feeling that Actors could play an important role in a SwiftData framework for safe access.

Additionally, Xcode could come with a UI that makes it easy to version data models and provide a graphical migration tool that could be written in a declarative Swift syntax and be previewed as a UML diagram on the right (like SwiftUI previews). But maybe I started dreaming too big here …

Probability

Many were expecting this already for the last two years because it’s a logical next step after SwiftUI. But this year, with Actors already shipped in Swift 5.5 and Distributed Actors (for iCloud support) being accepted just recently as well, the technology might just be ready to ship the first version by September.

Conclusion

There are lots of things Apple could announce in June, and the above are just my personal wishes. But in the past, I was always surprised by at least one or two frameworks entirely, like SwiftUI in 2019, WidgetKit in 2020, and DocC in 2021. What will it be this year? I can’t wait to find out!

Enjoyed this article? Follow me on Bluesky and Mastodon for more Swift tips and indie dev updates.