Generic Instance Method


Updates the provided gesture state property as the gesture’s value changes.


func updating<State>(_ state: GestureState<State>, body: @escaping (Self.Value, inout State, inout Transaction) -> Void) -> GestureStateGesture<Self, State>



A binding to a view’s GestureState property.


The callback that SwiftUI invokes as the gesture’s value changes. Its currentState parameter is the updated state of the gesture. The gestureState parameter is the previous state of the gesture, and the transaction is the context of the gesture.

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 users cancels or ends the gesture.


Use this callback to update transient UI state as described in Adding Interactivity with Gestures.

See Also

Performing the Gesture

func onChanged((Self.Value) -> Void) -> _ChangedGesture<Self>

Adds an action to perform when the gesture’s value changes.

func onEnded((Self.Value) -> Void) -> _EndedGesture<Self>

Adds an action to perform when the gesture ends.

associatedtype Value

The type representing the gesture’s value.