Contents

NSDraggingSession

An object that encapsulates a drag-and-drop action.

Declaration

class NSDraggingSession

Overview

You start a new dragging session by calling beginDraggingSession(with:event:source:) or beginDraggingSession(items:gesture:source:) on an NSView. The method immediately returns, and the actual drag begins at the next turn of the run loop.

Dragging sessions from gesture recognizers

NSDraggingSession provides APIs for better interoperation with gesture recognizers. Use beginDraggingSession(items:gesture:source:) to start a drag from a gesture recognizer. This replaces the tracking-loop-based beginDraggingSession(with:event:source:). AppKit cancels the initiating gesture recognizer during the drag, but the timing differs by input type: for a mouse-based gesture, cancellation happens at the end of the operation; for a touch-based gesture, it happens at the very start.

Topics

Dragging Pasteboard

Dragging Visual Representation

Identifying the Dragging Session

Enumerating Dragging Items

Dragging Session Location

Dragging Item Location

See Also

Drag Sources