Instance Method


Returns the source view to use when animating the appearance of the preview interface.


optional func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview?



The interaction object that triggered the preview.


The configuration object associated with the current interaction.

Return Value

An object containing the source view and configuration parameters for the animation.


UIKit calls this method before an interaction begins, to give you an opportunity to supply a custom source view for the presentation animations. If you didn't provide a preview handler block in the configuration data, UIKit displays the specified view in the preview interface.

See Also

Customizing the Preview Animations

Adding Menus and Shortcuts to the Menu Bar and User Interface

Provide quick access to useful actions by adding menus and keyboard shortcuts to your Mac Catalyst app.