swift posts

Subscribe to just swift posts via RSS.

Calling Swift from Rust

From the person that brought you calling Rust from Swift comes the thrilling[1], action[2]-packed sequel: calling Swift from Rust! For a recent project, I found myself needing to call into Swift from a Rust project (on both macOS and Linux) and so am documenting here in case you, too, are in this unenviable situation.

Tusker is Now Available


I am very excited to announce that after almost four and a half years of development, Tusker, my iOS app for Mastodon is now available on the App Store!

If you follow my blog or follow me on the fediverse, you’ve no doubt heard me talk at length about it before, so I’ll spare you the details here. Suffice it to say that Tusker is a completely native iOS app that supports many of the latest features of both Mastodon and iOS.

This is not the end of development, there are still lots of features I plan to add—including push notifications and the ability to edit posts. If you’re already in the beta via TestFlight, you’re more than welcome to remain there. It will continue to get beta updates with new features and bugfixes ahead of the App Store releases.

Live Activities (and Bad Apple)

I recently got nerd sniped by this tweet from Zhuowei Zhang about playing the Bad Apple video in the Dynamic Island on the iPhone 14 Pro. His original implementation used a webpage and the media session API, and this worked, but the system plays an animation when the artwork changes, so the framerate was limited to 2 FPS. Not ideal for watching a video. So, I wanted to see how much closer to watchable I could get.

This post isn’t going to be a detailed guide or anything, just a collection of some mildly interesting things I learned.

LiveView Native

I’m very excited for the project I’ve been working on all year to finally be public. LiveView Native is a library that lets you build native apps backed by Phoenix LiveView. I’ve been developing the iOS client which is backed by SwiftUI.

Using LiveView Native lets you avoid duplicating business logic on the frontend and save time on implementing dedicated APIs for native apps. The iOS client can be integrated into any existing app by using a single SwiftUI view, so it’s easy to adopt it for just a single screen at a time.

You can find the documentation[1] for the Swift package here, including a step-by-step tutorial which walks you through building a complete app with LiveView Native.

We’ve also developed a simple chat app which was used by the attendees of ElixirConf this year, and serves as a complete example of a LiveView Native app.

I’m very excited to see what people build with it.


This is the first time I’ve used DocC and it has been largely excellent. It’s made it very easy to produce nice-looking and well-organized documentation. And the tutorial mechanism has been very useful.

Adopting TextKit 2

With iOS 16, Apple switched on TextKit 2 for UITextViews. But, if you access any of the TextKit 1 objects on the text view, it will automatically fall back to a compatibility mode. All of the work I did to mimic Safari’s link context menu animation was, of course, using the TextKit 1 APIs, so it was blocking me from fully adopting TextKit 2. So, here’s how to update that code.