---
title: "dragSelection(with:offset:slideBack:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/dragselection(with:offset:slideback:)"
---

# dragSelection(with:offset:slideBack:)

Begins dragging the current selected text range.

## Declaration

```swift
func dragSelection(with event: NSEvent, offset mouseOffset: NSSize, slideBack: Bool) -> Bool
```

## Parameters

- `event`: The event that initiated dragging the selection.
- `mouseOffset`: The cursor’s current location relative to the mouse-down event.
- `slideBack`: doc://com.apple.documentation/documentation/Swift/true if the image being dragged should slide back to its original position if the drag does not succeed, doc://com.apple.documentation/documentation/Swift/false otherwise.

## Return Value

Return Value true if the drag can be successfully initiated, false otherwise.

## Discussion

Discussion Primarily for subclasses, who can override it to intervene at the beginning of a drag.

## See Also

### Dragging

- [dragImageForSelection(with:origin:)](appkit/nstextview/dragimageforselection(with:origin:).md)
- [dragOperation(for:type:)](appkit/nstextview/dragoperation(for:type:).md)
- [acceptsGlyphInfo](appkit/nstextview/acceptsglyphinfo.md)
