<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextViewDelegate/textView(_:draggedCell:in:event:at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextViewDelegate(im)textView:draggedCell:inRect:event:atIndex:"
  },
  "title" : "textView(_:draggedCell:in:event:at:)"
}
-->

# textView(_:draggedCell:in:event:at:)

Sent when the user attempts to drag a cell.

```
@MainActor optional func textView(_ view: NSTextView, draggedCell cell: any NSTextAttachmentCellProtocol, in rect: NSRect, event: NSEvent, at charIndex: Int)
```

## Parameters

`view`

The text view sending the message.

`cell`

The cell being dragged.

`rect`

The rectangle from which the cell was dragged.

`event`

The mouse-down event that preceded the mouse-dragged event.

`charIndex`

The character position where the mouse button was clicked.

## Discussion

The delegate can use this message as its cue to initiate a dragging operation.

## See Also

[`dragImage:at:offset:event:pasteboard:source:slideBack:`](/documentation/AppKit/NSView/dragImage:at:offset:event:pasteboard:source:slideBack:)

Initiates a dragging operation from the view, allowing the user to drag arbitrary data with a specified icon into any application that has window or view objects that accept dragged data.

[`dragFile(_:from:slideBack:event:)`](/documentation/AppKit/NSView/dragFile(_:from:slideBack:event:))

Initiates a dragging operation from the view, allowing the user to drag a file icon to any application that has window or view objects that accept files.



---

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)