---
title: UICollectionViewDelegate
framework: uikit
role: symbol
role_heading: Protocol
path: uikit/uicollectionviewdelegate
---

# UICollectionViewDelegate

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

## Declaration

```swift
@MainActor protocol UICollectionViewDelegate : UIScrollViewDelegate
```

## Overview

Overview A collection view delegate manages user interactions with the collection view’s contents, including item selection, highlighting, and performing actions on those items. The methods of this protocol are all optional. When configuring the collection view object, assign your delegate object to its delegate property. For more information, see UICollectionView.

## Topics

### Managing the selected cells

- [Changing the appearance of selected and highlighted cells](uikit/changing-the-appearance-of-selected-and-highlighted-cells.md)
- [Selecting multiple items with a two-finger pan gesture](uikit/selecting-multiple-items-with-a-two-finger-pan-gesture.md)
- [collectionView(_:shouldSelectItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:shouldselectitemat:).md)
- [collectionView(_:didSelectItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:didselectitemat:).md)
- [collectionView(_:shouldDeselectItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:shoulddeselectitemat:).md)
- [collectionView(_:didDeselectItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:diddeselectitemat:).md)
- [collectionView(_:shouldBeginMultipleSelectionInteractionAt:)](uikit/uicollectionviewdelegate/collectionview(_:shouldbeginmultipleselectioninteractionat:).md)
- [collectionView(_:didBeginMultipleSelectionInteractionAt:)](uikit/uicollectionviewdelegate/collectionview(_:didbeginmultipleselectioninteractionat:).md)
- [collectionViewDidEndMultipleSelectionInteraction(_:)](uikit/uicollectionviewdelegate/collectionviewdidendmultipleselectioninteraction(_:).md)

### Managing cell highlighting

- [collectionView(_:shouldHighlightItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:shouldhighlightitemat:).md)
- [collectionView(_:didHighlightItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:didhighlightitemat:).md)
- [collectionView(_:didUnhighlightItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:didunhighlightitemat:).md)

### Tracking the addition and removal of views

- [collectionView(_:willDisplay:forItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:willdisplay:foritemat:).md)
- [collectionView(_:willDisplaySupplementaryView:forElementKind:at:)](uikit/uicollectionviewdelegate/collectionview(_:willdisplaysupplementaryview:forelementkind:at:).md)
- [collectionView(_:didEndDisplaying:forItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:didenddisplaying:foritemat:).md)
- [collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:)](uikit/uicollectionviewdelegate/collectionview(_:didenddisplayingsupplementaryview:forelementofkind:at:).md)

### Handling layout changes

- [collectionView(_:transitionLayoutForOldLayout:newLayout:)](uikit/uicollectionviewdelegate/collectionview(_:transitionlayoutforoldlayout:newlayout:).md)
- [collectionView(_:targetContentOffsetForProposedContentOffset:)](uikit/uicollectionviewdelegate/collectionview(_:targetcontentoffsetforproposedcontentoffset:).md)
- [collectionView(_:targetIndexPathForMoveOfItemFromOriginalIndexPath:atCurrentIndexPath:toProposedIndexPath:)](uikit/uicollectionviewdelegate/collectionview(_:targetindexpathformoveofitemfromoriginalindexpath:atcurrentindexpath:toproposedindexpath:).md)

### Managing context menus

- [Adding context menus in your app](uikit/adding-context-menus-in-your-app.md)
- [collectionView(_:willDisplayContextMenu:animator:)](uikit/uicollectionviewdelegate/collectionview(_:willdisplaycontextmenu:animator:).md)
- [collectionView(_:willEndContextMenuInteraction:animator:)](uikit/uicollectionviewdelegate/collectionview(_:willendcontextmenuinteraction:animator:).md)
- [collectionView(_:willPerformPreviewActionForMenuWith:animator:)](uikit/uicollectionviewdelegate/collectionview(_:willperformpreviewactionformenuwith:animator:).md)
- [collectionView(_:contextMenuConfigurationForItemsAt:point:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfigurationforitemsat:point:).md)
- [collectionView(_:contextMenuConfiguration:highlightPreviewForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfiguration:highlightpreviewforitemat:).md)
- [collectionView(_:contextMenuConfiguration:dismissalPreviewForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfiguration:dismissalpreviewforitemat:).md)

### Working with focus

- [collectionView(_:canFocusItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:canfocusitemat:).md)
- [indexPathForPreferredFocusedView(in:)](uikit/uicollectionviewdelegate/indexpathforpreferredfocusedview(in:).md)
- [collectionView(_:shouldUpdateFocusIn:)](uikit/uicollectionviewdelegate/collectionview(_:shouldupdatefocusin:).md)
- [collectionView(_:didUpdateFocusIn:with:)](uikit/uicollectionviewdelegate/collectionview(_:didupdatefocusin:with:).md)
- [collectionView(_:selectionFollowsFocusForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:selectionfollowsfocusforitemat:).md)

### Editing items

- [collectionView(_:canEditItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:canedititemat:).md)

### Managing actions for cells

- [collectionView(_:canPerformPrimaryActionForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:canperformprimaryactionforitemat:).md)
- [collectionView(_:performPrimaryActionForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:performprimaryactionforitemat:).md)

### Handling scene transitions

- [collectionView(_:sceneActivationConfigurationForItemAt:point:)](uikit/uicollectionviewdelegate/collectionview(_:sceneactivationconfigurationforitemat:point:).md)

### Controlling the spring-loading behavior

- [collectionView(_:shouldSpringLoadItemAt:with:)](uikit/uicollectionviewdelegate/collectionview(_:shouldspringloaditemat:with:).md)

### Deprecated

- [collectionView(_:targetIndexPathForMoveFromItemAt:toProposedIndexPath:)](uikit/uicollectionviewdelegate/collectionview(_:targetindexpathformovefromitemat:toproposedindexpath:).md)
- [collectionView(_:contextMenuConfigurationForItemAt:point:)](uikit/uicollectionviewdelegate/collectionview(_:contextmenuconfigurationforitemat:point:).md)
- [collectionView(_:previewForDismissingContextMenuWithConfiguration:)](uikit/uicollectionviewdelegate/collectionview(_:previewfordismissingcontextmenuwithconfiguration:).md)
- [collectionView(_:previewForHighlightingContextMenuWithConfiguration:)](uikit/uicollectionviewdelegate/collectionview(_:previewforhighlightingcontextmenuwithconfiguration:).md)
- [collectionView(_:shouldShowMenuForItemAt:)](uikit/uicollectionviewdelegate/collectionview(_:shouldshowmenuforitemat:).md)
- [collectionView(_:canPerformAction:forItemAt:withSender:)](uikit/uicollectionviewdelegate/collectionview(_:canperformaction:foritemat:withsender:).md)
- [collectionView(_:performAction:forItemAt:withSender:)](uikit/uicollectionviewdelegate/collectionview(_:performaction:foritemat:withsender:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [UIScrollViewDelegate](uikit/uiscrollviewdelegate.md)

### Inherited By

- [UICollectionViewDelegateFlowLayout](uikit/uicollectionviewdelegateflowlayout.md)

### Conforming Types

- [UICollectionViewController](uikit/uicollectionviewcontroller.md)

## See Also

### Managing collection view interactions

- [delegate](uikit/uicollectionview/delegate.md)
