Menu

Post image 1
Post image 2
Post image 3
Post image 4
1 / 4
0

A Live Activity isn't a notification

DEV Community·Amanda Gama·28 days ago
#0lAqlYta
#ios#mobile#showdev#state#activity#widget
Reading 0:00
15s threshold

You're in another app and there's a timer counting down at the top of your phone. You lock the screen and the same timer is sitting there. You swipe down to the Notification Center and it's there too, still ticking. It looks like a notification, but a notification can't tick. That's a Live Activity. It looks like three different surfaces (Dynamic Island, lock-screen banner, Notification Center entry), but they're the same widget, rendered three ways by the OS. I wired one up for Tomoe, a focus timer I built. The punch line: it took a weekend. Most of that weekend was unlearning what I thought a Live Activity was. Once the shape clicked, the code was small. This post is the shape. What a Live Activity actually is Three things that get glossed over in most tutorials: It's a widget, not a notification. The view code lives in a Widget Extension target, separate from your app. The app pushes state; the extension renders pixels. If you've shipped a Home Screen widget before, this is the same story.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More