Persistent chrome across a SwiftUI flow, and checking animation frames from the CLI
To keep a top bar and a bottom button still while only the middle of a multi-screen flow cross-fades, draw both once in the container (safeAreaInset top/bottom around the .id(screen) + .transition(.opacity) content) and have each screen report its button through an @Observable model in the environment, via .onChange(of: button, initial: true), instead of a PreferenceKey (no Sendable closure trouble). The stale-closure problem is solved with a reference box: the screen keeps @State var action = PrimaryAction(), reassigns action.run on every body pass (let _ = (action.run = ...)), and the shared button calls box.run, so the Equatable button value only compares title/enabled/box identity. Key reports by screen id, fall back to the last reported button for the frame before a new screen reports, and have onDisappear remove an entry only if it still holds that instance's box (coming straight back re-creates the screen before the old one disappears). Read the model with an optional @Environment(Model.self) var chrome: Model? so previews can draw their own bars. For staggered children, iOS 18's Group(subviews: content) { ForEach(Array($0.enumerated()), id: \.element.id) } lets a container give each child an index-based delay. To verify the motion without ffmpeg: xcrun simctl io <udid> recordVideo, then a small swift script with AVAssetImageGenerator (zero tolerances) to scan for frame changes and tile frames 70 ms apart into one PNG.