<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTableView/deselectAll(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTableView(im)deselectAll:"
  },
  "title" : "deselectAll(_:)"
}
-->

# deselectAll(_:)

Deselects all selected rows or columns if empty selection is allowed; otherwise does nothing.

```
func deselectAll(_ sender: Any?)
```

## Parameters

`sender`

Typically the object that sent the message.

## Discussion

Posts [`selectionDidChangeNotification`](/documentation/AppKit/NSTableView/selectionDidChangeNotification) to the default notification center if the selection does in fact change.

As a target-action method, [`deselectAll(_:)`](/documentation/AppKit/NSTableView/deselectAll(_:)) checks with the delegate before changing the selection, using [`selectionShouldChange(in:)`](/documentation/AppKit/NSTableViewDelegate/selectionShouldChange(in:)).

## See Also

[`-  selectionShouldChangeInTableView:`](/documentation/AppKit/NSTableViewDelegate/selectionShouldChange(in:))

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

[`-  selectColumn:byExtendingSelection:`](/documentation/AppKit/NSTableView/selectColumn:byExtendingSelection:)

Selects the column at the specified index, optionally extending any existing selection.

[`allowsEmptySelection`](/documentation/AppKit/NSTableView/allowsEmptySelection)

A Boolean value indicating whether the table view allows the user to select zero columns or rows.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)