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

# dataSource

An object that provides data for the collection view.

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

## Discussion

The data source object manages the data in the collection view. Use this object to specify how many items are in the collection view and to create the visual representation of those items. The object you specify must adopt the [`NSCollectionViewDataSource`](/documentation/AppKit/NSCollectionViewDataSource) protocol.

To specify the data for your collection view, assign a value to this property or to the [`content`](/documentation/AppKit/NSCollectionView/content) property, but not both. If you specify a value for this property, the collection view ignores the [`content`](/documentation/AppKit/NSCollectionView/content) property and the `content` binding.

---

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)