Contents

webView(_:contextMenuConfigurationForElement:completionHandler:)

Tells the delegate that a contextual menu interaction began.

Declaration

optional func webView(_ webView: WKWebView, contextMenuConfigurationForElement elementInfo: WKContextMenuElementInfo, completionHandler: @escaping @MainActor @Sendable (UIContextMenuConfiguration?) -> Void)
optional func webView(_ webView: WKWebView, contextMenuConfigurationFor elementInfo: WKContextMenuElementInfo) async -> UIContextMenuConfiguration?

Parameters

  • webView:

    The web view in which the interaction occurred.

  • elementInfo:

    An object that contains information about the element involved in the interaction.

  • completionHandler:

    The completion handler for you to call with information about how you want to handle the interaction. This handler block has no return value and takes the following parameter:

    configuration

    The Uicontextmenuconfiguration object that contains the details of how you want to handle the interaction. Specify nil for this parameter if you don’t want to show a contextual menu.

See Also

Displaying a contextual menu