updating(_:body:)
Updates the provided gesture state property as the gesture’s value changes.
Declaration
@MainActor @preconcurrency func updating<State>(_ state: GestureState<State>, body: @escaping (Self.Value, inout State, inout Transaction) -> Void) -> GestureStateGesture<Self, State>Parameters
- state:
A binding to a view’s Gesturestate property.
- body:
The callback that SwiftUI invokes as the gesture’s value changes. Its
currentStateparameter is the updated state of the gesture. ThegestureStateparameter is the previous state of the gesture, and thetransactionis the context of the gesture.
Mentioned in
Return Value
A version of the gesture that updates the provided state as the originating gesture’s value changes and that resets the state to its initial value when the user or the system ends or cancels the gesture.
Discussion
Use this callback to update transient UI state as described in Adding interactivity with gestures.