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

# dataSource

The object that provides the data displayed by the receiver.

```
weak var dataSource: (any NSOutlineViewDataSource)? { get set }
```

## Discussion

The object must implement the appropriate methods of [`NSOutlineViewDataSource`](/documentation/AppKit/NSOutlineViewDataSource). Note that in versions of macOS prior to v10.12, the outline view did not retain the data source in a managed memory environment.

Setting the data source invokes [`tile()`](/documentation/AppKit/NSTableView/tile()).

If the data source doesn’t respond to all of the [`outlineView(_:child:ofItem:)`](/documentation/AppKit/NSOutlineViewDataSource/outlineView(_:child:ofItem:)), [`outlineView(_:isItemExpandable:)`](/documentation/AppKit/NSOutlineViewDataSource/outlineView(_:isItemExpandable:)), [`outlineView(_:numberOfChildrenOfItem:)`](/documentation/AppKit/NSOutlineViewDataSource/outlineView(_:numberOfChildrenOfItem:)), and [`outlineView(_:objectValueFor:byItem:)`](/documentation/AppKit/NSOutlineViewDataSource/outlineView(_:objectValueFor:byItem:)) methods, an <doc://com.apple.documentation/documentation/Foundation/NSExceptionName/internalInconsistencyException> may be raised.

## See Also

[Drag and Drop](/documentation/AppKit/drag-and-drop)

Support the direct manipulation of your app’s content using drag and drop.

[Outline View](/documentation/AppKit/outline-view)

Display a list-based interface for hierarchical data, where each level of hierarchy is indented from the previous one.



---

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)