Tuesday, August 27, 2024

Migrating KeyboardKit to Swift 6 Language Mode

Douglas Hill (tweet):

Over the weekend, I updated KeyboardKit to full data race safety with Swift 6 language mode. KeyboardKit is my open source framework that‘s the easiest way to add comprehensive hardware keyboard control to an iPad, iPhone, or Mac Catalyst app.

This is a great test case because KeyboardKit is a small UI framework that doesn’t perform any slow operations, so all its code is intended to be run on the main thread. It should be trivial to opt into strict concurrency. I didn’t want to spent more than about an hour on this.

Many issues were resolved simply by annotating types with @MainActor, but I wanted to share three interesting situations that came up in the migration, two of which seem like issues on Apple’s side.

[…]

No data race safety issues were exposed.

Previously:

Comments RSS · Twitter · Mastodon

Leave a Comment