> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swiftui/gestures/gesturestate.md).

# GestureState

[SwiftUI](/ios/swiftui.md) ⟩ [Gestures](/ios/swiftui/gestures.md) ⟩ GestureState

{% hint style="danger" %} <mark style="color:purple;">**`@GestureState`**</mark> will <mark style="color:red;">**reset**</mark> to the <mark style="color:red;">**original value**</mark> when the gesture <mark style="color:orange;">**ends**</mark>.
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="success" %}
Since <mark style="color:purple;">**`@GestureState`**</mark> property will <mark style="color:red;">**reset**</mark> itself, we need <mark style="color:orange;">**another**</mark> [`@State`](/ios/swiftui/view/state/value/state.md) property to save the <mark style="color:red;">**final state**</mark>.
{% endhint %}
{% endtab %}

{% tab title="💈範例" %}

* [Long Press](/ios/swiftui/gestures/long-press.md)
* [Drag](/ios/swiftui/gestures/drag.md)
* [long press + drag](/ios/swiftui/gestures/combine/sequenced/longpressdrag.md) - use custom [enum](/ios/swift/type/category/basic/enum.md) for its gesture state.
  {% endtab %}

{% tab title="📗 參考" %}

* [ ] Paul ⟩ [What is the @GestureState property wrapper?](https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-gesturestate-property-wrapper) - mentioned "<mark style="color:orange;">**transaction**</mark>".&#x20;
* [ ] NSScreencast ⟩ [SwiftUI Gestures](https://nsscreencast.com/episodes/400-swiftui-gestures)
  {% endtab %}

{% tab title="📘 手冊" %}

* [SwiftUI](https://developer.apple.com/documentation/swiftui) ⟩ [Gestures](https://developer.apple.com/documentation/swiftui/gestures) ⟩ [GestureState](https://developer.apple.com/documentation/swiftui/gesturestate) (<mark style="color:red;">**struct**</mark>)
  {% endtab %}

{% tab title="👥 相關" %}

* is [property wrapper](/ios/swift/type/prop/wrapper.md).
* used by [Long Press](/ios/swiftui/gestures/long-press.md), [Drag](/ios/swiftui/gestures/drag.md).
  {% endtab %}
  {% endtabs %}
