<!--
{
  "documentType" : "article",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/collection-view",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Collection View"
}
-->

# Collection View

Display one or more subviews in a highly configurable arrangement.

## Topics

### View

[`class NSCollectionView`](/documentation/AppKit/NSCollectionView)

An ordered collection of data items displayed in a customizable layout.

[`protocol NSCollectionViewSectionHeaderView`](/documentation/AppKit/NSCollectionViewSectionHeaderView)

A protocol that defines a button to control the collapse of a collection view’s section.

### Components

[`class NSCollectionLayoutItem`](/documentation/AppKit/NSCollectionLayoutItem)

The most basic component of a collection view’s layout.

[`class NSCollectionLayoutGroup`](/documentation/AppKit/NSCollectionLayoutGroup)

A container for a set of items that lays out the items along a path.

[`class NSCollectionLayoutSection`](/documentation/AppKit/NSCollectionLayoutSection)

A container that combines a set of groups into distinct visual groupings.

### Size and spacing

[`class NSCollectionLayoutDimension`](/documentation/AppKit/NSCollectionLayoutDimension)

An individual dimension representing an item’s width or height in a collection view.

[`class NSCollectionLayoutSize`](/documentation/AppKit/NSCollectionLayoutSize)

The width and the height of an item in a collection view.

[`class NSCollectionLayoutSpacing`](/documentation/AppKit/NSCollectionLayoutSpacing)

An object that defines the space between or around items in a collection view.

[`class NSCollectionLayoutEdgeSpacing`](/documentation/AppKit/NSCollectionLayoutEdgeSpacing)

An object that defines the space around the edges of items in a collection view.

[`protocol NSCollectionLayoutContainer`](/documentation/AppKit/NSCollectionLayoutContainer)

A protocol used to provide information about the size and content insets of a layout’s container.

### Data

[`protocol NSCollectionViewDataSource`](/documentation/AppKit/NSCollectionViewDataSource)

A set of methods that a data source object implements to provide the information and view objects that a collection view requires to present content.

[`protocol NSCollectionViewDelegate`](/documentation/AppKit/NSCollectionViewDelegate)

A set of methods that you use to manage the behavior of a collection view.

[`class NSCollectionViewDiffableDataSource`](/documentation/AppKit/NSCollectionViewDiffableDataSource-axww)

The object you use to manage data and provide items for a collection view.

[`struct NSDiffableDataSourceSnapshot`](/documentation/AppKit/NSDiffableDataSourceSnapshot-swift.struct)

A representation of the state of the data in a view at a specific point in time.

### Data

[`protocol NSCollectionViewDataSource`](/documentation/AppKit/NSCollectionViewDataSource)

A set of methods that a data source object implements to provide the information and view objects that a collection view requires to present content.

[`protocol NSCollectionViewDelegate`](/documentation/AppKit/NSCollectionViewDelegate)

A set of methods that you use to manage the behavior of a collection view.

[`class NSCollectionViewDiffableDataSourceReference`](/documentation/AppKit/NSCollectionViewDiffableDataSourceReference)

The object you use to manage data and provide items for a collection view.

[`class NSDiffableDataSourceSnapshotReference`](/documentation/AppKit/NSDiffableDataSourceSnapshotReference)

A representation of the state of the data in a view at a specific point in time.

### Items

[`class NSCollectionViewItem`](/documentation/AppKit/NSCollectionViewItem)

The visual representation for a single data element in a collection view.

[`protocol NSCollectionViewElement`](/documentation/AppKit/NSCollectionViewElement)

A set of methods that you use to manage the content in a collection view.

### Layouts

  <doc://com.apple.documentation/documentation/UIKit/implementing-modern-collection-views>

[`class NSCollectionViewFlowLayout`](/documentation/AppKit/NSCollectionViewFlowLayout)

A layout that organizes items into a flexible and configurable arrangement.

[`protocol NSCollectionViewDelegateFlowLayout`](/documentation/AppKit/NSCollectionViewDelegateFlowLayout)

A set of methods that a delegate implements to provide layout information to a flow layout object in a collection view.

[`class NSCollectionViewGridLayout`](/documentation/AppKit/NSCollectionViewGridLayout)

A layout that displays a single section of items in a row and column grid.

[`class NSCollectionViewTransitionLayout`](/documentation/AppKit/NSCollectionViewTransitionLayout)

An object that implements custom behaviors when changing from one layout to another in a collection view.

[`class NSCollectionViewLayoutAttributes`](/documentation/AppKit/NSCollectionViewLayoutAttributes)

An object that contains layout-related attributes for an element in a collection view.

[`class NSCollectionViewLayout`](/documentation/AppKit/NSCollectionViewLayout)

An abstract base class that you subclass and use to generate layout information for a collection view.

[`class NSCollectionViewCompositionalLayout`](/documentation/AppKit/NSCollectionViewCompositionalLayout)

A layout object that lets you combine items in highly adaptive and flexible visual arrangements.

[`class NSCollectionViewCompositionalLayoutConfiguration`](/documentation/AppKit/NSCollectionViewCompositionalLayoutConfiguration)

An object that defines scroll direction, section spacing, and headers or footers for the layout.

[`typealias NSCollectionViewCompositionalLayoutSectionProvider`](/documentation/AppKit/NSCollectionViewCompositionalLayoutSectionProvider)

A closure that creates and returns each of the layout’s sections.

[`enum NSCollectionLayoutSectionOrthogonalScrollingBehavior`](/documentation/AppKit/NSCollectionLayoutSectionOrthogonalScrollingBehavior)

The scrolling behavior of the layout’s sections in relation to the main layout axis.

### Appearance

[`class NSCollectionLayoutBoundarySupplementaryItem`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem)

An object used to add headers or footers to a collection view.

[`class NSCollectionLayoutSupplementaryItem`](/documentation/AppKit/NSCollectionLayoutSupplementaryItem)

An object used to add an extra visual decoration to an item in a collection view.

[`class NSCollectionLayoutDecorationItem`](/documentation/AppKit/NSCollectionLayoutDecorationItem)

An object used to add a background to a section of a collection view.

[`class NSCollectionLayoutAnchor`](/documentation/AppKit/NSCollectionLayoutAnchor)

An object that defines how to attach a supplementary item to an item in a collection view.

### Advanced layouts

[`class NSCollectionLayoutGroupCustomItem`](/documentation/AppKit/NSCollectionLayoutGroupCustomItem)

An item used in a group with a custom layout arrangement.

[`typealias NSCollectionLayoutGroupCustomItemProvider`](/documentation/AppKit/NSCollectionLayoutGroupCustomItemProvider)

A closure that creates and returns each of the custom group’s items.

### Layout updates

[`protocol NSCollectionLayoutVisibleItem`](/documentation/AppKit/NSCollectionLayoutVisibleItem)

An item that’s currently visible within the bounds of a section.

[`typealias NSCollectionLayoutSectionVisibleItemsInvalidationHandler`](/documentation/AppKit/NSCollectionLayoutSectionVisibleItemsInvalidationHandler)

A closure called before each layout cycle to allow modification of items in a section immediately before they’re displayed.

### Configuration

[`protocol NSCollectionLayoutEnvironment`](/documentation/AppKit/NSCollectionLayoutEnvironment)

A protocol used to provide information about the layout’s container and environment traits, such as size classes and display scale factor.

### Updates

[`class NSCollectionViewUpdateItem`](/documentation/AppKit/NSCollectionViewUpdateItem)

A description of a single change to make to an item in a collection view.

[`class NSCollectionViewLayoutInvalidationContext`](/documentation/AppKit/NSCollectionViewLayoutInvalidationContext)

An object that identifies the portions of your layout that need to be updated.

[`class NSCollectionViewFlowLayoutInvalidationContext`](/documentation/AppKit/NSCollectionViewFlowLayoutInvalidationContext)

An object that identifies the portions of a flow layout object that need to be updated.



---

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)