Instance Method

tableView(_:writeRowsWith:to:)

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

Declaration

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

Parameters

aTableView

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

YES if the drag operation is allowed, NO otherwise.

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

func tableView(NSTableView, acceptDrop: NSDraggingInfo, row: Int, dropOperation: NSTableView.DropOperation)

Called by aTableView when the mouse button is released over a table view that previously decided to allow a drop.

func tableView(NSTableView, namesOfPromisedFilesDroppedAtDestination: URL, forDraggedRowsWith: IndexSet)

Returns an array of filenames that represent the indexSet rows for a drag to dropDestination.

Deprecated
func tableView(NSTableView, updateDraggingItemsForDrag: NSDraggingInfo)

Implement this method to allow the table to update dragging items as they are dragged over a view.