Contents

contextMenuInteraction(_:configuration:highlightPreviewForItemWithIdentifier:)

Asks the delegate for a preview of the item with the specified identifier when a context-menu interaction begins.

Declaration

optional func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configuration: UIContextMenuConfiguration, highlightPreviewForItemWithIdentifier identifier: any NSCopying) -> UITargetedPreview?

Parameters

  • interaction:

    The context-menu interaction object.

  • configuration:

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

  • identifier:

    The identifier for the item to generate a preview for.

Return Value

A targeted preview object corresponding to the item with the identifier 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 system generates for the item.

See Also

Customizing the preview animations