Contents

selectionManager(_:makeDraggingSession:)

Creates and returns a dragging session for the specified gesture recognizer.

Declaration

optional func selectionManager(_ selectionManager: NSTextSelectionManager, makeDraggingSession gesture: NSGestureRecognizer) -> NSDraggingSession?

Parameters

  • selectionManager:

    The selection manager requesting the dragging session.

  • gesture:

    The gesture recognizer that detected the drag attempt.

Return Value

A new dragging session, or nil to prevent dragging.

Discussion

The selection manager calls this method when the user attempts to drag the current text selection. Use this method to customize the dragging behavior, including setting drag data and drag images.