<!--
{
  "documentType" : "article",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/protocol-implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Protocol Implementations"
}
-->

# Protocol Implementations

Access the diffable data source’s implementations of protocol methods.

## Discussion

The diffable data source type conforms to several protocols, including [`NSCollectionViewDataSource`](/documentation/AppKit/NSCollectionViewDataSource) and <doc://com.apple.documentation/documentation/Swift/Hashable>. This page lists the diffable data source type’s implementations of those protocol requirements.

## Topics

### Getting Item and Section Metrics

[`func collectionView(NSCollectionView, numberOfItemsInSection: Int) -> Int`](/documentation/AppKit/NSCollectionViewDataSource/collectionView(_:numberOfItemsInSection:))

Asks your data source object to provide the number of items in the specified section.

[`func numberOfSections(in: NSCollectionView) -> Int`](/documentation/AppKit/NSCollectionViewDataSource/numberOfSections(in:))

Asks your data source object to provide the total number of sections.

### Getting Views for Items

[`func collectionView(NSCollectionView, itemForRepresentedObjectAt: IndexPath) -> NSCollectionViewItem`](/documentation/AppKit/NSCollectionViewDataSource/collectionView(_:itemForRepresentedObjectAt:))

Asks your data source object to provide the item at the specified location in the collection view.

[`func collectionView(NSCollectionView, viewForSupplementaryElementOfKind: NSCollectionView.SupplementaryElementKind, at: IndexPath) -> NSView`](/documentation/AppKit/NSCollectionViewDataSource/collectionView(_:viewForSupplementaryElementOfKind:at:))

Asks your data source object to provide the supplementary view at the specified location in a section of the collection view.

### Debugging a Diffable Data Source

[`func description() -> String`](/documentation/AppKit/NSCollectionViewDiffableDataSource-axww/description())

Returns a string with a description of the diffable data source.



---

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)