Collection views
Display nested views using a configurable and highly customizable layout.
Overview
A collection view manages an ordered set of content, such as the grid of photos in the Photos app, and presents it visually.
[Image]
Collection views are a collaboration between many different objects, including:
Cells. A cell provides the visual representation for each piece of your content.
Layouts. A layout defines the visual arrangement of the content in the collection view.
Your data source object. This object adopts the UICollectionViewDataSource protocol and provides the data for the collection view.
Your delegate object. This object adopts the UICollectionViewDelegate protocol and manages user interactions with the collection view’s contents, like selection and highlighting.
Collection view controller. You typically use a UICollectionViewController object to manage a collection view. You can use other view controllers too, but a collection view controller is required for some collection-related features to work.
Topics
View
Data
Updating collection views using diffable data sourcesImplementing modern collection viewsBuilding high-performance lists and collection viewsUICollectionViewDiffableDataSourceUICollectionViewDataSourceUICollectionViewDataSourcePrefetchingNSDiffableDataSourceSnapshotNSDiffableDataSourceSectionSnapshotUIRefreshControl
Cells
Layouts
Selection management
Changing the appearance of selected and highlighted cellsSelecting multiple items with a two-finger pan gesture
Drag and drop
Supporting Drag and Drop in Collection ViewsUICollectionViewDragDelegateUICollectionViewDropDelegateUICollectionViewDropCoordinatorUICollectionViewDropPlaceholderUICollectionViewDropProposalUICollectionViewDropItemUICollectionViewDropPlaceholderContextUIDataSourceTranslatingUICollectionViewPlaceholder