Protocol

UICollectionViewDropDelegate

The interface for handling drops in a collection view.

Declaration

protocol UICollectionViewDropDelegate

Overview

Implement this protocol in the object that you use to incorporate dropped data into your collection view. The only required method of this protocol is the collectionView(_:performDropWith:) method, but you can implement other methods as needed to customize the drop behavior of your collection view.

Assign your custom delegate object to the dropDelegate property of your collection view.

Topics

Declaring Support for Handling Drops

func collectionView(UICollectionView, canHandle: UIDropSession) -> Bool

Asks your delegate whether the collection view can accept a drop with the specified type of data.

Incorporating the Dropped Data

func collectionView(UICollectionView, performDropWith: UICollectionViewDropCoordinator)

Tells your delegate to incorporate the drop data into the collection view.

Required.

Tracking the Drag Movements

func collectionView(UICollectionView, dropSessionDidEnter: UIDropSession)

Notifies you when dragged content enters the collection view’s bounds rectangle.

func collectionView(UICollectionView, dropSessionDidExit: UIDropSession)

Notifies you when dragged content exits the table view’s bounds rectangle.

Providing a Custom Preview

func collectionView(UICollectionView, dropPreviewParametersForItemAt: IndexPath) -> UIDragPreviewParameters?

Returns custom information about how to display the item at the specified location during the drop.

Relationships

Inherits From

See Also

Drag and Drop

Supporting Drag and Drop in Collection Views

Initiate drags and handle drops from a collection view.

protocol UICollectionViewDragDelegate

The interface for initiating drags from a collection view.

protocol UICollectionViewDropCoordinator

An interface for coordinating your custom drop-related actions with the collection view.

class UICollectionViewDropPlaceholder

A placeholder for an item dropped on a collection view.

class UICollectionViewDropProposal

Your proposed solution for handling a drop in a collection view.

protocol UICollectionViewDropItem

The data associated with an item being dropped into the collection view.

protocol UICollectionViewDropPlaceholderContext

An object that contains information about a placeholder in the collection view.

protocol UIDataSourceTranslating

An advanced interface for managing a data source object.

class UICollectionViewPlaceholder

A placeholder for an item dragged or dropped on a collection view.