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

# outlineView(_:sortDescriptorsDidChange:)

Invoked by an outline view to notify the data source that the descriptors changed and the data may need to be resorted.

```
@MainActor optional func outlineView(_ outlineView: NSOutlineView, sortDescriptorsDidChange oldDescriptors: [NSSortDescriptor])
```

## Parameters

`outlineView`

The outline view that sent the message.

`oldDescriptors`

An array that contains the previous descriptors.

## Discussion

The data source typically sorts and reloads the data, and adjusts the selections accordingly. If you need to know the current sort descriptors and the data source does not itself manage them, you can get `outlineView`’s current sort descriptors by sending it a [`sortDescriptors`](/documentation/AppKit/NSTableView/sortDescriptors) message.

---

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)