Contents

browser(_:validateDrop:proposedRow:column:dropOperation:)

Sent to the delegate during a dragging session to determine whether a drop should be accepted and to obtain the drop location. This method is required for a browser to be a drag destination.

Declaration

@MainActor optional func browser(_ browser: NSBrowser, validateDrop info: any NSDraggingInfo, proposedRow row: UnsafeMutablePointer<Int>, column: UnsafeMutablePointer<Int>, dropOperation: UnsafeMutablePointer<NSBrowser.DropOperation>) -> NSDragOperation

Parameters

  • browser:

    The browser.

  • info:

    The drag session information.

  • row:

    On input, the proposed drop row. On output, the drop row.

  • column:

    On input, the proposed drop column. On output, the drop column.

  • dropOperation:

    On input, the proposed drop location. On output, the drop location.

Return Value

The drag operation that the data source is to perform. For the browser to accept the drop, it must not be NSDragOperationNone.

Discussion

The browser proposes a drop column, row, and row-relative location for the drop based on the pointer position, as shown in this table:

Drop relative location

Description

On

Dragging location (dragInfo``.draggingLocation) is closer to the middle of row than to either of its vertical sides.

Above

Dragging location is between two rows. Indicates a drop location above row and below row - 1.

These are a few examples of how to specify a drop location:

Row index

Row-relative location

On row 2

2

On

Between rows 2 and 3

3

Above

Below the last row

[sender numberOfRows]

Above

All rows

-1

On

See Also

Related Documentation

Dragging