---
title: "onLongPressGesture(minimumDuration:maximumDistance:inputKinds:perform:onPressingChanged:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/onlongpressgesture(minimumduration:maximumdistance:inputkinds:perform:onpressingchanged:)"
---

# onLongPressGesture(minimumDuration:maximumDistance:inputKinds:perform:onPressingChanged:)

Adds an action to perform when this view recognizes a long press gesture.

## Declaration

```swift
nonisolated func onLongPressGesture(minimumDuration: Double = 0.5, maximumDistance: CGFloat = 10, inputKinds: GestureInputKinds = .all, perform action: @escaping () -> Void, onPressingChanged: ((Bool) -> Void)? = nil) -> some View

```

## Parameters

- `minimumDuration`: The minimum duration of the long press that must elapse before the gesture succeeds.
- `maximumDistance`: The maximum distance that the fingers or cursor performing the long press can move before the gesture fails.
- `inputKinds`: A set of input kinds that this gesture recognizes. If not specified, the gesture will recognize all applicable input kinds that a person can use to perform it.
- `action`: The action to perform when a long press is recognized.
- `onPressingChanged`: A closure to run when the pressing state of the gesture changes, passing the current state as a parameter.

## See Also

### Recognizing long-press gestures

- [onLongPressGesture(minimumDuration:maximumDistance:perform:onPressingChanged:)](swiftui/view/onlongpressgesture(minimumduration:maximumdistance:perform:onpressingchanged:).md)
- [onLongPressGesture(minimumDuration:perform:onPressingChanged:)](swiftui/view/onlongpressgesture(minimumduration:perform:onpressingchanged:).md)
- [onLongTouchGesture(minimumDuration:perform:onTouchingChanged:)](swiftui/view/onlongtouchgesture(minimumduration:perform:ontouchingchanged:).md)
- [LongPressGesture](swiftui/longpressgesture.md)
