<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextView/dragSelection(with:offset:slideBack:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextView(im)dragSelectionWithEvent:offset:slideBack:"
  },
  "title" : "dragSelection(with:offset:slideBack:)"
}
-->

# dragSelection(with:offset:slideBack:)

Begins dragging the current selected text range.

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

<doc://com.apple.documentation/documentation/Swift/true> if the drag can be successfully initiated, <doc://com.apple.documentation/documentation/Swift/false> otherwise.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)