tableView(_:draggingSession:willBeginAt:forRowIndexes:)
Implement this method to determine when a dragging session will begin.
Declaration
@MainActor optional func tableView(_ tableView: NSTableView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forRowIndexes rowIndexes: IndexSet)Parameters
- tableView:
The table view.
- session:
The dragging session.
- screenPoint:
The initial drag location in screen coordinates.
- rowIndexes:
The indexes of the rows to be dragged, excluding rows that were not dragged due to Tableview(_:pasteboardwriterforrow:) returning
nil.
Discussion
Implement this method to know when the dragging session is about to begin and to potentially modify the dragging session.
The dragged item order will directly match the pasteboard writer array used to begin the dragging session with the NSView method beginDraggingSession(with:event:source:). Hence, the order is deterministic, and can be used in tableView(_:acceptDrop:row:dropOperation:) when enumerating the NSDraggingInfo pasteboard classes.
See Also
Drag and Drop
Supporting Table View Drag and Drop Through File PromisestableView(_:acceptDrop:row:dropOperation:)tableView(_:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWith:)tableView(_:validateDrop:proposedRow:proposedDropOperation:)tableView(_:writeRowsWith:to:)tableView(_:updateDraggingItemsForDrag:)tableView(_:draggingSession:endedAt:operation:)