---
title: GestureState
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/gesturestate
---

# GestureState

A property wrapper type that updates a property while the user performs a gesture and resets the property back to its initial state when the gesture ends.

## Declaration

```swift
@propertyWrapper @frozen struct GestureState<Value>
```

## Mentioned in

Adding interactivity with gestures

## Overview

Overview Declare a property as @GestureState, pass as a binding to it as a parameter to a gesture’s updating(_:body:) callback, and receive updates to it. A property that’s declared as @GestureState implicitly resets when the gesture becomes inactive, making it suitable for tracking transient state. Add a long-press gesture to a Circle, and update the interface during the gesture by declaring a property as @GestureState: struct SimpleLongPressGestureView: View {     @GestureState private var isDetectingLongPress = false

var longPress: some Gesture {         LongPressGesture(minimumDuration: 3)             .updating($isDetectingLongPress) { currentState, gestureState, transaction in                 gestureState = currentState             }     }

var body: some View {         Circle()             .fill(self.isDetectingLongPress ? Color.red : Color.green)             .frame(width: 100, height: 100, alignment: .center)             .gesture(longPress)     } }

## Topics

### Creating a gesture state

- [init(initialValue:)](swiftui/gesturestate/init(initialvalue:).md)
- [init(initialValue:reset:)](swiftui/gesturestate/init(initialvalue:reset:).md)
- [init(initialValue:resetTransaction:)](swiftui/gesturestate/init(initialvalue:resettransaction:).md)
- [init(reset:)](swiftui/gesturestate/init(reset:).md)
- [init(resetTransaction:)](swiftui/gesturestate/init(resettransaction:).md)
- [init(wrappedValue:)](swiftui/gesturestate/init(wrappedvalue:).md)
- [init(wrappedValue:reset:)](swiftui/gesturestate/init(wrappedvalue:reset:).md)
- [init(wrappedValue:resetTransaction:)](swiftui/gesturestate/init(wrappedvalue:resettransaction:).md)

### Getting the state

- [wrappedValue](swiftui/gesturestate/wrappedvalue.md)
- [projectedValue](swiftui/gesturestate/projectedvalue.md)

## Relationships

### Conforms To

- [DynamicProperty](swiftui/dynamicproperty.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Managing gesture state

- [GestureStateGesture](swiftui/gesturestategesture.md)
