---
title: "tableView(_:writeRowsWith:to:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstableviewdatasource/tableview(_:writerowswith:to:)"
---

# tableView(_:writeRowsWith:to:)

Returns a Boolean value that indicates whether a drag operation is allowed.

## Declaration

```swift
optional func tableView(_ tableView: NSTableView, writeRowsWith rowIndexes: IndexSet, to pboard: NSPasteboard) -> Bool
```

## Parameters

- `tableView`: The table view that sent the message.
- `rowIndexes`: An index set of row numbers that will be participating in the drag.
- `pboard`: The pasteboard to which to write the drag data.

## Return Value

Return Value YES if the drag operation is allowed, NO otherwise.

## Discussion

Discussion Called by aTableView after it has been determined that a drag should begin, but before the drag has been started. To refuse the drag, return false. To start a drag, return true and place the drag data onto pboard (data, owner, and so on). The drag image and other drag-related information will be set up and provided by the table view once this call returns with true.

## See Also

### Drag and Drop

- [Supporting Table View Drag and Drop Through File Promises](appkit/supporting-table-view-drag-and-drop-through-file-promises.md)
- [tableView(_:acceptDrop:row:dropOperation:)](appkit/nstableviewdatasource/tableview(_:acceptdrop:row:dropoperation:).md)
- [tableView(_:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWith:)](appkit/nstableviewdatasource/tableview(_:namesofpromisedfilesdroppedatdestination:fordraggedrowswith:).md)
- [tableView(_:validateDrop:proposedRow:proposedDropOperation:)](appkit/nstableviewdatasource/tableview(_:validatedrop:proposedrow:proposeddropoperation:).md)
- [tableView(_:draggingSession:willBeginAt:forRowIndexes:)](appkit/nstableviewdatasource/tableview(_:draggingsession:willbeginat:forrowindexes:).md)
- [tableView(_:updateDraggingItemsForDrag:)](appkit/nstableviewdatasource/tableview(_:updatedraggingitemsfordrag:).md)
- [tableView(_:draggingSession:endedAt:operation:)](appkit/nstableviewdatasource/tableview(_:draggingsession:endedat:operation:).md)
