Docs

Advent · Day 23

This one opens on December 23.

Every door opens at midnight Pacific.

See the calendar

Live Activities

Five SwiftPieces Pro templates put what's happening right now on the Lock Screen and in the Dynamic Island, in the app's own brand.

Five Pro templates ship a Live Activity: Pulse, Stillwater, Sprig, Atelier and Wayfare. Each one shows on the Lock Screen and in the Dynamic Island in the app's own colours, and starts and ends from the app's own code.

TemplateWhat it followsStarted by
Pulse (Fitness)A session in progress: the phase, the round and its time left, the session barPulseLiveActivity.follow, from the running session
Stillwater (Meditation)A breathing session: the breath to take now and the time leftSessionPlayerView
Sprig (Meal Planner)Cook mode: the recipe, the step and its timer, a segment per stepCookModeView, while a step timer runs
Atelier (Shop)An order out for delivery: its stage on a five-step track and when it arrivesAtelierDeliveryActivity.sync
Wayfare (Travel)A trip day: what's next on today's plan and when, with the day's progressWayfareTripActivity.sync

Where it lives

  • The Live Activity's view is in Widget/Sources/<App>LiveActivityWidget.swift, next to the template's widgets.
  • Its attributes and the code that starts, updates and ends it live in the app's shared module, so the app and the extension agree on one type.
  • Pulse, Stillwater and Sprig count their timers down on their own, so the app only updates the activity when something changes.

To ship one, keep NSSupportsLiveActivities in the app's Info.plist (the template sets it) and test it on a device or a simulator with a Dynamic Island.

On this page