<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/onLongPressGesture(minimumDuration:maximumDistance:inputKinds:perform:onPressingChanged:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE18onLongPressGesture15minimumDuration15maximumDistance10inputKinds7perform0D15PressingChangedQrSd_14CoreFoundation7CGFloatVAA0g5InputM0VyycySbcSgtF"
  },
  "title" : "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.

```
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.

---

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)