<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPressGestureRecognizer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPressGestureRecognizer"
  },
  "title" : "NSPressGestureRecognizer"
}
-->

# NSPressGestureRecognizer

A discrete gesture recognizer that tracks whether the user holds down a mouse button for a minimum amount of time before releasing it.

```
class NSPressGestureRecognizer
```

## Overview

Use a press gesture recognizer to configure which button the user must hold and the length of time they must hold it. You can also specify how far the mouse can move for a valid gesture.

Upon creation, the gesture recognizer recognizes press gestures involving only the primary button. It also delays sending primary button events to the view by setting the [`delaysPrimaryMouseButtonEvents`](/documentation/AppKit/NSGestureRecognizer/delaysPrimaryMouseButtonEvents) property to <doc://com.apple.documentation/documentation/Swift/true>. To change the set of buttons to track, modify the [`buttonMask`](/documentation/AppKit/NSPressGestureRecognizer/buttonMask) property.

## Topics

### Configuring the gesture recognizer

[`allowableMovement`](/documentation/AppKit/NSPressGestureRecognizer/allowableMovement)

The maximum movement of the mouse in the view before the gesture fails.

[`buttonMask`](/documentation/AppKit/NSPressGestureRecognizer/buttonMask)

A bit mask of the buttons required to recognize this press.

[`minimumPressDuration`](/documentation/AppKit/NSPressGestureRecognizer/minimumPressDuration)

The minimum time (in seconds) that the user must hold the mouse button in the view for a valid gesture.

[`numberOfTouchesRequired`](/documentation/AppKit/NSPressGestureRecognizer/numberOfTouchesRequired)

The number of necessary touches on a Touch Bar for the gesture recognizer to match.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

### Inherits From

[`NSGestureRecognizer`](/documentation/AppKit/NSGestureRecognizer)

---

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)