<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Gesture/updating(_:body:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7GesturePAAE8updating_4bodyAA0c5StateC0Vyxqd__GAA0cF0Vyqd__G_y5ValueQz_qd__zAA11TransactionVztctlF"
  },
  "title" : "updating(_:body:)"
}
-->

# updating(_:body:)

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

```
@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`](/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.

## 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](/documentation/SwiftUI/Adding-Interactivity-with-Gestures).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)