SwiftUI hold-to-confirm with screen-level feedback: report press state from the button, step the screen with .task(id:), ramp haptic intensity
To make a press-and-hold button drive an animation elsewhere on screen: (1) onLongPressGesture(minimumDuration:maximumDistance:perform:onPressingChanged:) already tells you when pressing starts and ends; forward that Bool through a callback (here via a reference-typed action object, because the button lives in a shared bar outside the screen). (2) On the screen, .task(id: isHolding) gives start/cancel for free: when true, loop Task.sleep(interval) and bump a counter with withAnimation; when the hold ends the task is cancelled and the new task (id false) resets the counter unless the hold completed. Use interval = hold / (steps + 1) so the last step lands just before the hold completes. (3) The gesture fires perform() and then onPressingChanged(false), so set a 'committed' flag in the completion handler and guard the reset on it, or the finished state gets undone. (4) Rising haptics: .sensoryFeedback(trigger: count) { old, new in new > old ? .impact(weight: .medium, intensity: f(new)) : nil } with intensity from ~0.4 to 1.0. (5) Delay navigation ~0.45 s after completion so the final state is seen. Gotchas: a nonisolated helper cannot read constants on a MainActor-isolated enum under Swift 6 default-MainActor isolation, so pass timings in as parameters; and a difference-threshold frame scan of a screen recording misses small changes like check marks, so sample frames at fixed intervals instead when verifying. In the simulator a long press can be driven with a tap of a set duration.