<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionView"
  },
  "title" : "UICollectionView"
}
-->

# UICollectionView

An object that manages an ordered collection of data items and presents them using customizable layouts.

```
@MainActor class UICollectionView
```

## Overview

When you add a collection view to your user interface, your app’s main job is to manage the data associated with that collection view. The collection view gets its data from the data source object, stored in the collection view’s [`dataSource`](/documentation/UIKit/UICollectionView/dataSource) property. For your data source, you can use a [`UICollectionViewDiffableDataSource`](/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa) object, which provides the behavior you need to simply and efficiently manage updates to your collection view’s data and user interface. Alternatively, you can create a custom data source object by adopting the [`UICollectionViewDataSource`](/documentation/UIKit/UICollectionViewDataSource) protocol.

Data in the collection view is organized into individual items, which you can group into sections for presentation. An item is the smallest unit of data you want to present. For example, in a photos app, an item might be a single image. The collection view presents items onscreen using a cell, which is an instance of the [`UICollectionViewCell`](/documentation/UIKit/UICollectionViewCell) class that your data source configures and provides.

![A collection view using the flow layout.](images/com.apple.uikit/uicollectionview-1~dark@2x.png)

In addition to its cells, a collection view can present data using other types of views. These supplementary views can be, for example, section headers and footers that are separate from the individual cells but still convey information. Support for supplementary views is optional and defined by the collection view’s layout object, which is also responsible for defining the placement of those views.

Besides embedding a [`UICollectionView`](/documentation/UIKit/UICollectionView) in your user interface, you use the methods of the collection view to ensure that the visual presentation of items matches the order in your data source object. A [`UICollectionViewDiffableDataSource`](/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa) object manages this process automatically. If you’re using a custom data source, then whenever you add, delete, or rearrange data in your collection, you use the methods of [`UICollectionView`](/documentation/UIKit/UICollectionView) to insert, delete, and rearrange the corresponding cells.

You also use the collection view object to manage the selected items, although for this behavior the collection view works with its associated [`delegate`](/documentation/UIKit/UICollectionView/delegate) object.

### Layouts

A layout object defines the visual arrangement of the content in the collection view. A subclass of the [`UICollectionViewLayout`](/documentation/UIKit/UICollectionViewLayout) class, the layout object defines the organization and location of all cells and supplementary views inside the collection view. Although it defines their locations, the layout object doesn’t actually apply that information to the corresponding views. The collection view applies layout information to the corresponding views because the creation of cells and supplementary views involves coordination between the collection view and your data source object. The layout object is like another data source, except it provides visual information instead of item data.

You typically specify a layout object when you create a collection view, but you can also change the layout of a collection view dynamically. The layout object is stored in the [`collectionViewLayout`](/documentation/UIKit/UICollectionView/collectionViewLayout) property. Setting this property directly updates the layout immediately, without animating the changes. If you want to animate the changes, call the [`setCollectionViewLayout(_:animated:completion:)`](/documentation/UIKit/UICollectionView/setCollectionViewLayout(_:animated:completion:)) method instead.

To create an interactive transition — one that is driven by a gesture recognizer or touch events — use the [`startInteractiveTransition(to:completion:)`](/documentation/UIKit/UICollectionView/startInteractiveTransition(to:completion:)) method to change the layout object. That method installs an intermediate layout object, which works with your gesture recognizer or event-handling code to track the transition progress. When your event-handling code determines that the transition is finished, it calls the [`finishInteractiveTransition()`](/documentation/UIKit/UICollectionView/finishInteractiveTransition()) or [`cancelInteractiveTransition()`](/documentation/UIKit/UICollectionView/cancelInteractiveTransition()) method to remove the intermediate layout object and install the intended target layout object.

For more information, see [Layouts](/documentation/UIKit/layouts).

### Cells and supplementary views

The collection view’s data source object provides both the content for items and the views used to present that content. When the collection view first loads its content, it asks its data source to provide a view for each visible item. The collection view maintains a queue or list of view objects that the data source has marked for reuse. Instead of creating new views explicitly in your code, you always dequeue views.

There are two methods for dequeueing views. The one you use depends on which type of view has been requested:

- Use the [`dequeueReusableCell(withReuseIdentifier:for:)`](/documentation/UIKit/UICollectionView/dequeueReusableCell(withReuseIdentifier:for:)) to get a cell for an item in the collection view.
- Use the [`dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)`](/documentation/UIKit/UICollectionView/dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)) method to get a supplementary view requested by the layout object.

Before you call either of these methods, you must tell the collection view how to create the corresponding view if one doesn’t already exist. For this, you must register either a class or a nib file with the collection view. For example, when registering cells, you use the [`register(_:forCellWithReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forCellWithReuseIdentifier:)-3vaho) method to register a class or the [`register(_:forCellWithReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forCellWithReuseIdentifier:)-6z6t4) method to register a nib file. As part of the registration process, you specify the reuse identifier that identifies the purpose of the view. This is the same string you use when dequeueing the view later.

After dequeueing the appropriate view in your data source method, configure its content and return it to the collection view for use. After getting the layout information from the layout object, the collection view applies it to the view and displays it.

### Data prefetching

Collection views provide two prefetching techniques you can use to improve responsiveness:

- *Cell prefetching* prepares cells in advance of the time they’re required. When a collection view requires a large number of cells simultaneously — for example, a new row of cells in grid layout — the cells are requested earlier than the time required for display. Cell rendering is therefore spread across multiple layout passes, resulting in a smoother scrolling experience. Cell prefetching is enabled by default.
- *Data prefetching* provides a mechanism whereby you’re notified of the data requirements of a collection view in advance of the requests for cells. This is useful if the content of your cells relies on an expensive data loading process, such as a network request. Assign an object that conforms to the [`UICollectionViewDataSourcePrefetching`](/documentation/UIKit/UICollectionViewDataSourcePrefetching) protocol to the [`prefetchDataSource`](/documentation/UIKit/UICollectionView/prefetchDataSource) property to receive notifications of when to prefetch data for cells.

### Reorder items interactively

Collection views allow you to move items around based on user interactions. Typically, the order of items in a collection view is defined by your data source. If you allow users to reorder items, you can configure a gesture recognizer to track the user’s interactions with a collection view item and update that item’s position.

To begin the interactive repositioning of an item, call the [`beginInteractiveMovementForItem(at:)`](/documentation/UIKit/UICollectionView/beginInteractiveMovementForItem(at:)) method of the collection view. While your gesture recognizer is tracking touch events, call the [`updateInteractiveMovementTargetPosition(_:)`](/documentation/UIKit/UICollectionView/updateInteractiveMovementTargetPosition(_:)) method to report changes in the touch location. When you’re done tracking the gesture, call the [`endInteractiveMovement()`](/documentation/UIKit/UICollectionView/endInteractiveMovement()) or [`cancelInteractiveMovement()`](/documentation/UIKit/UICollectionView/cancelInteractiveMovement()) method to conclude the interactions and update the collection view.

During user interactions, the collection view invalidates its layout dynamically to reflect the current position of the item. If you do nothing, the default layout behavior repositions the items for you, but you can customize the layout animations if you want. When interactions finish, the collection view updates its data source object with the new location of the item.

The [`UICollectionViewController`](/documentation/UIKit/UICollectionViewController) class provides a default gesture recognizer that you can use to rearrange items in its managed collection view. To install this gesture recognizer, set the [`installsStandardGestureForInteractiveMovement`](/documentation/UIKit/UICollectionViewController/installsStandardGestureForInteractiveMovement) property of the collection view controller to <doc://com.apple.documentation/documentation/Swift/true>.

### Interface Builder attributes

The following table lists the attributes that you configure for collection views in Interface Builder.

|Attribute|Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|Items    |The number of prototype cells. This property controls the specified number of prototype cells for you to configure in your storyboard. Collection views must always have at least one cell and may have multiple cells for displaying different types of content or for displaying the same content in different ways.                                                                                                                                                                                                                                                                                                                                                                                                             |
|Layout   |The layout object to use. Use this control to select between the ``doc://com.apple.uikit/documentation/UIKit/UICollectionViewFlowLayout`` object and a custom layout object that you define. ![](spacer) When the flow layout is selected, you can also configure the scrolling direction for the collection view’s content and whether the flow layout has header and footer views. Enabling header and footer views adds reusable views to your storyboard that you can configure with your header and footer content. You can also create those views programmatically. ![](spacer) When a custom layout is selected, you must specify the ``doc://com.apple.uikit/documentation/UIKit/UICollectionViewLayout`` subclass to use.|

When the Flow layout is selected, the Size inspector for the collection view contains additional attributes for configuring flow layout metrics. Use those attributes to configure the size of your cells, the size of headers and footers, the minimum spacing between cells, and any margins around each section of cells. For more information about the meaning of the flow layout metrics, see [`UICollectionViewFlowLayout`](/documentation/UIKit/UICollectionViewFlowLayout).

### Internationalization

A collection view has no direct content of its own to internationalize. Instead, you internationalize the cells and reusable views of the collection view. For more information about internationalization, see [Localization](https://developer.apple.com/localization/).

### Accessibility

A collection view has no content of its own to make accessible. If your cells and reusable views contain standard UIKit controls such as [`UILabel`](/documentation/UIKit/UILabel) and [`UITextField`](/documentation/UIKit/UITextField), you can make those controls accessible. When a collection view changes its onscreen layout, it posts the [`layoutChanged`](/documentation/UIKit/UIAccessibility/Notification/layoutChanged) notification.

For general information about making your interface accessible, see [Accessibility for UIKit](/documentation/UIKit/accessibility-for-uikit).

## Topics

### Creating a collection view

[`init(frame:collectionViewLayout:)`](/documentation/UIKit/UICollectionView/init(frame:collectionViewLayout:))

Creates a collection view object with the specified frame and layout.

[`init(coder:)`](/documentation/UIKit/UICollectionView/init(coder:))

Creates a collection view object from data in a given unarchiver.

### Providing the collection view data

[`dataSource`](/documentation/UIKit/UICollectionView/dataSource)

The object that provides the data for the collection view.

[`UICollectionViewDiffableDataSource`](/documentation/UIKit/UICollectionViewDiffableDataSource-9tqpa)

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

[`UICollectionViewDataSource`](/documentation/UIKit/UICollectionViewDataSource)

The methods adopted by the object you use to manage data and provide cells for a collection view.

[Building high-performance lists and collection views](/documentation/UIKit/building-high-performance-lists-and-collection-views)

Improve the performance of lists and collections in your app with prefetching and image preparation.

### Providing the collection view data

[`dataSource`](/documentation/UIKit/UICollectionView/dataSource)

The object that provides the data for the collection view.

[`UICollectionViewDiffableDataSourceReference`](/documentation/UIKit/UICollectionViewDiffableDataSourceReference)

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

[`UICollectionViewDataSource`](/documentation/UIKit/UICollectionViewDataSource)

The methods adopted by the object you use to manage data and provide cells for a collection view.

[Building high-performance lists and collection views](/documentation/UIKit/building-high-performance-lists-and-collection-views)

Improve the performance of lists and collections in your app with prefetching and image preparation.

### Prefetching collection view cells and data

[`isPrefetchingEnabled`](/documentation/UIKit/UICollectionView/isPrefetchingEnabled)

A Boolean value that indicates whether cell and data prefetching are enabled.

[`prefetchDataSource`](/documentation/UIKit/UICollectionView/prefetchDataSource)

The object that acts as the prefetching data source for the collection view, receiving notifications of upcoming cell data requirements.

[`UICollectionViewDataSourcePrefetching`](/documentation/UIKit/UICollectionViewDataSourcePrefetching)

A protocol that provides advance warning of the data requirements for a collection view, allowing the triggering of asynchronous data load operations.

### Managing collection view interactions

[`delegate`](/documentation/UIKit/UICollectionView/delegate)

The object that acts as the delegate of the collection view.

[`UICollectionViewDelegate`](/documentation/UIKit/UICollectionViewDelegate)

The methods adopted by the object you use to manage user interactions with items in a collection view.

### Creating cells

[`UICollectionView.CellRegistration`](/documentation/UIKit/UICollectionView/CellRegistration)

A registration for the collection view’s cells.

[`UICollectionViewCellRegistration`](/documentation/UIKit/UICollectionViewCellRegistration)

A registration for the collection view’s cells.

[`dequeueConfiguredReusableCellWithRegistration:forIndexPath:item:`](/documentation/UIKit/UICollectionView/dequeueConfiguredReusableCellWithRegistration:forIndexPath:item:)

Dequeues a configured reusable cell object.

[`dequeueConfiguredReusableCell(using:for:item:)`](/documentation/UIKit/UICollectionView/dequeueConfiguredReusableCell(using:for:item:))

Dequeues a configured reusable cell object.

[`register(_:forCellWithReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forCellWithReuseIdentifier:)-3vaho)

Registers a class for use in creating new collection view cells.

[`register(_:forCellWithReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forCellWithReuseIdentifier:)-6z6t4)

Registers a nib file for use in creating new collection view cells.

[`dequeueReusableCell(withReuseIdentifier:for:)`](/documentation/UIKit/UICollectionView/dequeueReusableCell(withReuseIdentifier:for:))

Dequeues a reusable cell object located by its identifier.

### Creating headers and footers

[`UICollectionView.SupplementaryRegistration`](/documentation/UIKit/UICollectionView/SupplementaryRegistration)

A registration for the collection view’s supplementary views.

[`UICollectionViewSupplementaryRegistration`](/documentation/UIKit/UICollectionViewSupplementaryRegistration)

A registration for the collection view’s supplementary views.

[`dequeueConfiguredReusableSupplementaryViewWithRegistration:forIndexPath:`](/documentation/UIKit/UICollectionView/dequeueConfiguredReusableSupplementaryViewWithRegistration:forIndexPath:)

Dequeues a configured reusable supplementary view object.

[`dequeueConfiguredReusableSupplementary(using:for:)`](/documentation/UIKit/UICollectionView/dequeueConfiguredReusableSupplementary(using:for:))

Dequeues a configured reusable supplementary view object.

[`register(_:forSupplementaryViewOfKind:withReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forSupplementaryViewOfKind:withReuseIdentifier:)-661io)

Registers a class for use in creating supplementary views for the collection view.

[`register(_:forSupplementaryViewOfKind:withReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forSupplementaryViewOfKind:withReuseIdentifier:)-9hn73)

Registers a nib file for use in creating supplementary views for the collection view.

[`dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)`](/documentation/UIKit/UICollectionView/dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:))

Dequeues a reusable supplementary view located by its identifier and kind.

### Configuring the background view

[`backgroundView`](/documentation/UIKit/UICollectionView/backgroundView)

The view that provides the background appearance.

### Changing the layout

[`collectionViewLayout`](/documentation/UIKit/UICollectionView/collectionViewLayout)

The layout used to organize the collected view’s items.

[`setCollectionViewLayout(_:animated:)`](/documentation/UIKit/UICollectionView/setCollectionViewLayout(_:animated:))

Changes the collection view’s layout and optionally animates the change.

[`setCollectionViewLayout(_:animated:completion:)`](/documentation/UIKit/UICollectionView/setCollectionViewLayout(_:animated:completion:))

Changes the collection view’s layout and notifies you when the animations complete.

[`startInteractiveTransition(to:completion:)`](/documentation/UIKit/UICollectionView/startInteractiveTransition(to:completion:))

Changes the collection view’s current layout using an interactive transition effect.

[`finishInteractiveTransition()`](/documentation/UIKit/UICollectionView/finishInteractiveTransition())

Tells the collection view to finish an interactive transition by installing the intended target layout.

[`cancelInteractiveTransition()`](/documentation/UIKit/UICollectionView/cancelInteractiveTransition())

Tells the collection view to cancel an interactive transition and return to its original layout object.

[`UICollectionView.LayoutInteractiveTransitionCompletion`](/documentation/UIKit/UICollectionView/LayoutInteractiveTransitionCompletion)

The completion block called at the end of an interactive transition for a collection view.

### Getting the state of the collection view

[`numberOfSections`](/documentation/UIKit/UICollectionView/numberOfSections)

The number of sections displayed by the collection view.

[`numberOfItems(inSection:)`](/documentation/UIKit/UICollectionView/numberOfItems(inSection:))

Fetches the count of items in the specified section.

[`visibleCells`](/documentation/UIKit/UICollectionView/visibleCells)

An array of visible cells currently displayed by the collection view.

### Inserting, moving, and deleting Items

[`insertItems(at:)`](/documentation/UIKit/UICollectionView/insertItems(at:))

Inserts new items at the specified index paths.

[`moveItem(at:to:)`](/documentation/UIKit/UICollectionView/moveItem(at:to:))

Moves an item from one location to another in the collection view.

[`deleteItems(at:)`](/documentation/UIKit/UICollectionView/deleteItems(at:))

Deletes the items at the specified index paths.

### Inserting, moving, and deleting sections

[`insertSections(_:)`](/documentation/UIKit/UICollectionView/insertSections(_:))

Inserts new sections at the specified indexes.

[`moveSection(_:toSection:)`](/documentation/UIKit/UICollectionView/moveSection(_:toSection:))

Moves a section from one location to another in the collection view.

[`deleteSections(_:)`](/documentation/UIKit/UICollectionView/deleteSections(_:))

Deletes the sections at the specified indexes.

### Reordering items interactively

[`beginInteractiveMovementForItem(at:)`](/documentation/UIKit/UICollectionView/beginInteractiveMovementForItem(at:))

Initiates the interactive movement of the item at the specified index path.

[`updateInteractiveMovementTargetPosition(_:)`](/documentation/UIKit/UICollectionView/updateInteractiveMovementTargetPosition(_:))

Updates the position of the item within the collection view’s bounds.

[`endInteractiveMovement()`](/documentation/UIKit/UICollectionView/endInteractiveMovement())

Ends interactive movement tracking and moves the target item to its new location.

[`cancelInteractiveMovement()`](/documentation/UIKit/UICollectionView/cancelInteractiveMovement())

Ends interactive movement tracking and returns the target item to its original location.

### Managing drag interactions

[`dragDelegate`](/documentation/UIKit/UICollectionView/dragDelegate)

The delegate object that manages the dragging of items from the collection view.

[`UICollectionViewDragDelegate`](/documentation/UIKit/UICollectionViewDragDelegate)

The interface for initiating drags from a collection view.

[`hasActiveDrag`](/documentation/UIKit/UICollectionView/hasActiveDrag)

A Boolean value that indicates whether items were lifted from the collection view and have not yet been dropped.

[`dragInteractionEnabled`](/documentation/UIKit/UICollectionView/dragInteractionEnabled)

A Boolean value that indicates whether the collection view supports dragging content.

### Managing drop interactions

[`dropDelegate`](/documentation/UIKit/UICollectionView/dropDelegate)

The delegate object that manages the dropping of items into the collection view.

[`UICollectionViewDropDelegate`](/documentation/UIKit/UICollectionViewDropDelegate)

The interface for handling drops in a collection view.

[`hasActiveDrop`](/documentation/UIKit/UICollectionView/hasActiveDrop)

A Boolean value that indicates whether the collection view is currently tracking a drop session.

[`reorderingCadence`](/documentation/UIKit/UICollectionView/reorderingCadence-swift.property)

The speed at which items in the collection view are reordered to show potential drop locations.

[`UICollectionView.ReorderingCadence`](/documentation/UIKit/UICollectionView/ReorderingCadence-swift.enum)

Constants indicating the speed at which collection view items are reorganized during a drop.

### Selecting cells

[`indexPathsForSelectedItems`](/documentation/UIKit/UICollectionView/indexPathsForSelectedItems)

The index paths for the selected items.

[`selectItem(at:animated:scrollPosition:)`](/documentation/UIKit/UICollectionView/selectItem(at:animated:scrollPosition:))

Selects the item at the specified index path and optionally scrolls it into view.

[`deselectItem(at:animated:)`](/documentation/UIKit/UICollectionView/deselectItem(at:animated:))

Deselects the item at the specified index.

[`allowsSelection`](/documentation/UIKit/UICollectionView/allowsSelection)

A Boolean value that indicates whether users can select items in the collection view.

[`allowsMultipleSelection`](/documentation/UIKit/UICollectionView/allowsMultipleSelection)

A Boolean value that determines whether users can select more than one item in the collection view.

[`allowsSelectionDuringEditing`](/documentation/UIKit/UICollectionView/allowsSelectionDuringEditing)

A Boolean value that determines whether users can select cells while the collection view is in editing mode.

[`allowsMultipleSelectionDuringEditing`](/documentation/UIKit/UICollectionView/allowsMultipleSelectionDuringEditing)

A Boolean value that controls whether users can select more than one cell simultaneously in editing mode.

[`selectionFollowsFocus`](/documentation/UIKit/UICollectionView/selectionFollowsFocus)

A Boolean value that triggers an automatic selection when focus moves to a cell.

### Putting the collection view into edit mode

[`isEditing`](/documentation/UIKit/UICollectionView/isEditing)

A Boolean value that determines whether the collection view is in editing mode.

### Locating items and views in the collection view

[`indexPathForItem(at:)`](/documentation/UIKit/UICollectionView/indexPathForItem(at:))

Gets the index path of the item at the specified point in the collection view.

[`indexPathsForVisibleItems`](/documentation/UIKit/UICollectionView/indexPathsForVisibleItems)

An array of the visible items in the collection view.

[`indexPath(for:)`](/documentation/UIKit/UICollectionView/indexPath(for:))

Gets the index path of the specified cell.

[`cellForItem(at:)`](/documentation/UIKit/UICollectionView/cellForItem(at:))

Gets the cell object at the index path you specify.

[`indexPathsForVisibleSupplementaryElements(ofKind:)`](/documentation/UIKit/UICollectionView/indexPathsForVisibleSupplementaryElements(ofKind:))

Gets the index paths of all visible supplementary views of the specified type.

[`supplementaryView(forElementKind:at:)`](/documentation/UIKit/UICollectionView/supplementaryView(forElementKind:at:))

Gets the supplementary view at the specified index path.

[`visibleSupplementaryViews(ofKind:)`](/documentation/UIKit/UICollectionView/visibleSupplementaryViews(ofKind:))

Gets an array of the visible supplementary views of the specified kind.

### Getting layout information

[`layoutAttributesForItem(at:)`](/documentation/UIKit/UICollectionView/layoutAttributesForItem(at:))

Gets the layout information for the item at the specified index path.

[`layoutAttributesForSupplementaryElement(ofKind:at:)`](/documentation/UIKit/UICollectionView/layoutAttributesForSupplementaryElement(ofKind:at:))

Gets the layout information for the specified supplementary view.

### Scrolling an item into view

[`scrollToItem(at:at:animated:)`](/documentation/UIKit/UICollectionView/scrollToItem(at:at:animated:))

Scrolls the collection view contents until the specified item is visible.

[`UICollectionView.ScrollPosition`](/documentation/UIKit/UICollectionView/ScrollPosition)

Constants that indicate how to scroll an item into the visible portion of the collection view.

[`UICollectionView.ScrollDirection`](/documentation/UIKit/UICollectionView/ScrollDirection)

Constants that indicate the direction of scrolling for the layout.

### Animating multiple changes to the collection view

[`performBatchUpdates(_:completion:)`](/documentation/UIKit/UICollectionView/performBatchUpdates(_:completion:))

Animates multiple insert, delete, reload, and move operations as a group.

### Reloading content

[`hasUncommittedUpdates`](/documentation/UIKit/UICollectionView/hasUncommittedUpdates)

A Boolean value that indicates whether the collection view contains drop placeholders or is reordering its items as part of handling a drop.

[`reconfigureItems(at:)`](/documentation/UIKit/UICollectionView/reconfigureItems(at:))

Updates the data for the items at the index paths you specify, preserving the existing cells for the items.

[`reloadData()`](/documentation/UIKit/UICollectionView/reloadData())

Reloads all of the data for the collection view.

[`reloadSections(_:)`](/documentation/UIKit/UICollectionView/reloadSections(_:))

Reloads the data in the specified sections of the collection view.

[`reloadItems(at:)`](/documentation/UIKit/UICollectionView/reloadItems(at:))

Reloads just the items at the specified index paths.

### Identifying collection view elements

[`UICollectionView.ElementCategory`](/documentation/UIKit/UICollectionView/ElementCategory)

Constants specifying the type of view.

[`elementKindSectionFooter`](/documentation/UIKit/UICollectionView/elementKindSectionFooter)

A supplementary view that identifies the footer for a given section.

[`elementKindSectionHeader`](/documentation/UIKit/UICollectionView/elementKindSectionHeader)

A supplementary view that identifies the header for a given section.

### Working with focus

[`allowsFocus`](/documentation/UIKit/UICollectionView/allowsFocus)

A Boolean value that determines whether the collection view allows its cells to become focused.

[`allowsFocusDuringEditing`](/documentation/UIKit/UICollectionView/allowsFocusDuringEditing)

A Boolean value that determines whether the collection view allows its cells to become focused in edit mode.

[`selectionFollowsFocus`](/documentation/UIKit/UICollectionView/selectionFollowsFocus)

A Boolean value that triggers an automatic selection when focus moves to a cell.

[`remembersLastFocusedIndexPath`](/documentation/UIKit/UICollectionView/remembersLastFocusedIndexPath)

A Boolean value that indicates whether the collection view automatically assigns the focus to the item at the last focused index path.

### Managing context menus

[`contextMenuInteraction`](/documentation/UIKit/UICollectionView/contextMenuInteraction)

The collection view’s context menu interaction.

### Resizing self-sizing cells

[`selfSizingInvalidation`](/documentation/UIKit/UICollectionView/selfSizingInvalidation-swift.property)

The mode that the collection view uses for invalidating the size of self-sizing cells.

[`UICollectionView.SelfSizingInvalidation`](/documentation/UIKit/UICollectionView/SelfSizingInvalidation-swift.enum)

Constants that describe modes for invalidating the size of self-sizing collection view cells.



---

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)