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

# gesture(_:)

Attaches an NSGestureRecognizerRepresentable to the view.

## Declaration

```swift
nonisolated func gesture(_ representable: some NSGestureRecognizerRepresentable) -> some View

```

## Parameters

- `representable`: The doc://com.apple.SwiftUI/documentation/SwiftUI/NSGestureRecognizerRepresentable that creates and manages a gesture recognizer.

## Return Value

Return Value A view with an NSGestureRecognizerRepresentable attached.

## See Also

### Recognizing gestures that change over time

- [gesture(_:isEnabled:)](swiftui/view/gesture(_:isenabled:).md)
- [gesture(_:name:isEnabled:)](swiftui/view/gesture(_:name:isenabled:).md)
- [gesture(_:including:)](swiftui/view/gesture(_:including:).md)
- [DragGesture](swiftui/draggesture.md)
- [WindowDragGesture](swiftui/windowdraggesture.md)
- [MagnifyGesture](swiftui/magnifygesture.md)
- [RotateGesture](swiftui/rotategesture.md)
- [RotateGesture3D](swiftui/rotategesture3d.md)
- [GestureMask](swiftui/gesturemask.md)
