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

# delegate

The table view’s delegate.

```
weak var delegate: (any NSTableViewDelegate)? { get set }
```

## Discussion

The delegate must conform to the [`NSTableViewDelegate`](/documentation/AppKit/NSTableViewDelegate) protocol. Setting the delegate will implicitly reload the table view. Note that in versions of macOS prior to v10.12, the table view did not retain the delegate in a managed memory environment.

### Special Considerations

When you set the table view’s delegate, it is automatically registered for the following notifications with the following delegate methods:

- The notification named [`selectionDidChangeNotification`](/documentation/AppKit/NSTableView/selectionDidChangeNotification) is configured to notify the delegate’s [`tableViewSelectionDidChange(_:)`](/documentation/AppKit/NSTableViewDelegate/tableViewSelectionDidChange(_:)).
- The notification named [`columnDidMoveNotification`](/documentation/AppKit/NSTableView/columnDidMoveNotification) is configured to notify the delegate’s [`tableViewColumnDidMove(_:)`](/documentation/AppKit/NSTableViewDelegate/tableViewColumnDidMove(_:)).
- The notification named [`columnDidResizeNotification`](/documentation/AppKit/NSTableView/columnDidResizeNotification) is configured to notify the delegate’s [`tableViewColumnDidResize(_:)`](/documentation/AppKit/NSTableViewDelegate/tableViewColumnDidResize(_:)).
- The notification named [`selectionIsChangingNotification`](/documentation/AppKit/NSTableView/selectionIsChangingNotification) is configured to notify the delegate’s [`tableViewSelectionIsChanging(_:)`](/documentation/AppKit/NSTableViewDelegate/tableViewSelectionIsChanging(_:)).

Setting the delegate to `nil` causes these notifications to be disconnected. Rather than setting the delegate to `nil` and listening for notifications (and expecting `NSTableView` to still function correctly) you should instead implement the appropriate delegate method.

---

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)