<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7GestureP"
  },
  "title" : "Gesture"
}
-->

# Gesture

An instance that matches a sequence of events to a gesture, and returns a
stream of values for each of its states.

```
@MainActor @preconcurrency protocol Gesture<Value>
```

## Overview

Create custom gestures by declaring types that conform to the `Gesture`
protocol.

## Topics

### Implementing a custom gesture

[`body`](/documentation/SwiftUI/Gesture/body-swift.property)

The content and behavior of the gesture.

[`Body`](/documentation/SwiftUI/Gesture/Body-swift.associatedtype)

The type of gesture representing the body of `Self`.

### Performing the gesture

[`updating(_:body:)`](/documentation/SwiftUI/Gesture/updating(_:body:))

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

[`onChanged(_:)`](/documentation/SwiftUI/Gesture/onChanged(_:))

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

[`onEnded(_:)`](/documentation/SwiftUI/Gesture/onEnded(_:))

Adds an action to perform when the gesture ends.

[`Value`](/documentation/SwiftUI/Gesture/Value)

The type representing the gesture’s value.

### Composing gestures

[`simultaneously(with:)`](/documentation/SwiftUI/Gesture/simultaneously(with:))

Combines a gesture with another gesture to create a new gesture that
recognizes both gestures at the same time.

[`sequenced(before:)`](/documentation/SwiftUI/Gesture/sequenced(before:))

Sequences a gesture with another one to create a new gesture, which
results in the second gesture only receiving events after the first
gesture succeeds.

[`exclusively(before:)`](/documentation/SwiftUI/Gesture/exclusively(before:))

Combines two gestures exclusively to create a new gesture where only one
gesture succeeds, giving precedence to the first gesture.

### Adding modifier keys to a gesture

[`modifiers(_:)`](/documentation/SwiftUI/Gesture/modifiers(_:))

Combines a gesture with keyboard modifiers.

### Transforming a gesture

[`map(_:)`](/documentation/SwiftUI/Gesture/map(_:))

Returns a gesture that uses the given closure to map over this
gesture’s value.

### Customizing gesture activation

[`handActivationBehavior(_:)`](/documentation/SwiftUI/Gesture/handActivationBehavior(_:))

Customizes the activation behavior for a gesture when driven by hand
or hand-like input.

### Using a gesture with a RealityKit entity

[`targetedToAnyEntity()`](/documentation/SwiftUI/Gesture/targetedToAnyEntity())

Requires this gesture to target an entity.

[`targetedToEntity(_:)`](/documentation/SwiftUI/Gesture/targetedToEntity(_:))

Requires this gesture to target an entity or a descendant of entity.

[`targetedToEntity(where:)`](/documentation/SwiftUI/Gesture/targetedToEntity(where:))

Requires this gesture to target an entity that can be found in the results of the query.



---

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)