Contents

collectionView(_:contextMenuConfiguration:highlightPreviewForItemAt:)

Asks the delegate for a preview of the item at the specified index path when a context-menu interaction begins.

Declaration

optional func collectionView(_ collectionView: UICollectionView, contextMenuConfiguration configuration: UIContextMenuConfiguration, highlightPreviewForItemAt indexPath: IndexPath) -> UITargetedPreview?

Parameters

  • collectionView:

    The collection view containing the item.

  • configuration:

    The configuration of the menu to present if the interaction proceeds.

  • indexPath:

    The index path of the item where the interaction occurs.

Return Value

A targeted preview object corresponding to the item at the index path to use during the menu’s highlight and presentation animation.

Discussion

The system calls this method when a context-menu interaction begins. Implement this method to override the default highlight preview that the collection view generates for the item at indexPath.

See Also

Managing context menus