---
title: NSPressGestureRecognizer
framework: appkit
role: symbol
role_heading: Class
path: appkit/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.

## Declaration

```swift
class NSPressGestureRecognizer
```

## Overview

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 property to true. To change the set of buttons to track, modify the buttonMask property.

## Topics

### Configuring the Gesture Recognizer

- [allowableMovement](appkit/nspressgesturerecognizer/allowablemovement.md)
- [buttonMask](appkit/nspressgesturerecognizer/buttonmask.md)
- [minimumPressDuration](appkit/nspressgesturerecognizer/minimumpressduration.md)
- [numberOfTouchesRequired](appkit/nspressgesturerecognizer/numberoftouchesrequired.md)

## Relationships

### Inherits From

- [NSGestureRecognizer](appkit/nsgesturerecognizer.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Standard Gestures

- [NSClickGestureRecognizer](appkit/nsclickgesturerecognizer.md)
- [NSPanGestureRecognizer](appkit/nspangesturerecognizer.md)
- [NSRotationGestureRecognizer](appkit/nsrotationgesturerecognizer.md)
- [NSMagnificationGestureRecognizer](appkit/nsmagnificationgesturerecognizer.md)
