Last night as a stepped stage timeline you scrub, with stage totals as capsule bars.
A night of sleep as a hypnogram: stages drawn as stepped blocks across the night, a scrubber you drag to read the stage and time under your finger, stage totals as capsule bars, and bedtime, wake and restfulness figures that update with the night you pick.
$199 once, every piece included. See how installing works · Sign in
SwiftUI source you own, built on Apple frameworks only.
Studio (style), Health and Fitness (brief), Meditation and Sleep (brief), Daily Health (recipe). Your agent builds around this screen in the same design.
Sleep App (template)
How it behaves, what it handles, and the decisions behind it.
A night reads as a shape before it reads as data: each stage is a solid block in its own lane (Awake, REM, Light, Deep), joined to the next by a hairline step, drawn in from the left whenever the night changes. Drag anywhere on the chart and a scrubber follows your finger with a chip reading the stage and time under it, a haptic as it crosses into another stage, and the stage totals below lighting up with it. Swipe the time asleep, or tap a night in the strip, to move through the week.
[SleepSegment] per night, in order and without gaps, and pass them to SleepTimeline(segments:). HealthKit's sleep analysis samples map one to one.scrub to read the time under the finger elsewhere. The array helpers sleepStageTotals, sleepAsleep, sleepInBed, sleepEfficiency and sleepSegment(at:) do the arithmetic the screen shows.fills and inks by stage, so the chart is painted in your theme's blocks. The example uses four scheme blocks and the family's numerals for every figure.SleepTimelineExample at the end of SleepTimeline.swift is the screen shown in the preview; copy it as a starting point.Pieces that work well next to this one.