---
title: "selectionManager(_:makeDraggingSession:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextselectionmanager/delegate-swift.protocol/selectionmanager(_:makedraggingsession:)"
---

# selectionManager(_:makeDraggingSession:)

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

## Declaration

```swift
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

Return Value A new dragging session, or nil to prevent dragging.

## Discussion

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.
