Gesture Recognizers
Gesture recognizers, which were added in OS X 10.10, provide a higher-level means of handling mouse input. If you have used UIKit’s gesture recognizers on iOS you will find them very familiar.
Each gesture recognizer is designed to recognize one specific gesture:
-
NSClickGestureRecognizer
-
NSPanGestureRecognizer
-
NSMagnificationGestureRecognizer
-
NSPressGestureRecognizer
-
NSRotationGestureRecognizer
Gesture recognizers are added to a specific view and report the gestures using target/action, just like controls:
func setupPan() { let pan = NSPanGestureRecognizer(target: self, ...
Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.