Contents

selectionShouldChange(in:)

Asks the delegate if the user is allowed to change the selection.

Declaration

@MainActor optional func selectionShouldChange(in tableView: NSTableView) -> Bool

Parameters

  • tableView:

    The table view that sent the message.

Return Value

true to allow the table view to change its selection (typically a row being edited), false to deny selection change.

Discussion

The user can select and edit different cells within the same row, but can’t select another row unless the delegate approves. The delegate can implement this method for complex validation of edited rows based on the values of any of their cells.

See Also

Selecting rows