macos-touch-gestures
macOS Touch Gestures Skill
Read This First
Before editing any file, read the whole reference file for the active task from start to finish. Each reference starts with a Detection patterns section, and the patterns assume it. When a site matches more than one task, read each matching reference before the first edit.
When to Use
Use this skill whenever the request is about any of the following, whether or not it names an API:
- Making a Mac app work with direct touch, including a touch display connected through Sidecar.
- Adopting
NSGestureRecognizerin place ofmouseDown:,mouseDragged:,mouseUp:overrides ornextEvent(matching:)loops. - Taps, scrolling, long presses, drags, pinch, rotate, context menus, drag and drop, hover-revealed controls, popovers or outside-click dismissal that misbehave with touch.
- Gesture recognizers that block each other, never fire, or fire twice.
Scope
Targeted changes in Swift and Objective-C AppKit code. Examples are in Swift; the Detection lists give Objective-C spellings (for example shouldReceiveTouch: for gestureRecognizer(_:shouldReceive:)).
SwiftUI and Mac Catalyst (UIKit) sections inside the task files apply only in files already in that framework. Do not convert AppKit code to SwiftUI or UIKit or mix their patterns into AppKit classes; when a framework has no equivalent for a pattern, leave the code in place and do not invent an API.