Class

NSTouch

A snapshot of a particular touch at an instant in time.

Overview

A touch event is not persistent throughout the touch, new instances are created as the touch progresses. The identity property is used to follow a specific touch across its lifetime.

Touches do not have a corresponding screen location. The first touch of a touch collection is latched to the view underlying the cursor using the same hit detection as mouse events. Additional touches on the same device are also latched to the same view as any other touching touches. A touch remains latched to its view until the touch has either ended or is cancelled.

Topics

Properties of this touch

var identity: NSCopying & NSObjectProtocol

Use this property to track changes to a particular touch during the touch's life.

var phase: NSTouch.Phase

The current phase of the touch.

var normalizedPosition: NSPoint

The normalized position of the touch.

Properties of Touch Device

var device: Any?

The digitizer that generated the touch. Useful to distinguish touches emanating from multiple-device scenario.

var deviceSize: NSSize

The range of the touch device in points (72ppi).

Constants

struct NSTouch.Phase

The possible phases of a touch. These constants are used by phase.

Relationships

Inherits From

See Also

Mouse, Keyboard, and Touch Events

class NSEvent

An object that contains information about an input action such as a mouse click or a key press.

init(type: NSEvent.EventType)

Returns the event mask for the specified type.