---
title: "updating(_:body:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/gesture/updating(_:body:)"
---

# updating(_:body:)

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

## Declaration

```swift
@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 doc://com.apple.SwiftUI/documentation/SwiftUI/GestureState property.
- `body`: 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.

## Mentioned in

Adding interactivity with gestures

## Return Value

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

Discussion Use this callback to update transient UI state as described in Adding interactivity with gestures.

## See Also

### Performing the gesture

- [onChanged(_:)](swiftui/gesture/onchanged(_:).md)
- [onEnded(_:)](swiftui/gesture/onended(_:).md)
- [Value](swiftui/gesture/value.md)
