Module 17 Β· Widgets & Live Activities β Lesson 3 of 4 Β· ~8 min
A Live Activity for the active walk
ActivityKit's two-part shape: static vs. dynamic
A Live Activity is described by one type you define, conforming to ActivityAttributes. It splits into two kinds of data:
- Static attributes β set once, when the activity starts, and never change for its whole lifetime: the booking id, the walker's name. These are plain properties on the
ActivityAttributes-conforming struct.
- Dynamic content state β the part that updates live while the walk is happening: elapsed seconds, distance walked so far. This lives in a nested type named
ContentState, conforming toCodableandHashable(so the system can serialize and compare it, including over a push notification).
The Lock Screen banner and the Dynamic Island both render from the current ContentState β same data, different presentation depending on where iOS shows it.