Instance Method

tableView(_:acceptDrop:row:dropOperation:)

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

Declaration

optional func tableView(_ tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableView.DropOperation) -> Bool

Parameters

aTableView

The table view that sent the message.

info

An object that contains more information about this dragging operation.

row

The index of the proposed target row.

operation

The type of dragging operation.

Return Value

true if the drop operation was successful, otherwise false.

Discussion

The data source should incorporate the data from the dragging pasteboard in the implementation of this method. You can use the draggingPasteboard() method to get the data for the drop operation from info.

To accept a drop on the second row, row would be 2 and operation would be NSTableViewDropOn. To accept a drop below the last row, row would be [aTableView numberOfRows] and operation would be NSTableViewDropAbove.

See Also

Drag and 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, writeRowsWith: IndexSet, to: NSPasteboard)

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

func tableView(NSTableView, updateDraggingItemsForDrag: NSDraggingInfo)

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