<!--
{
  "availability" : [
    "iOS: 10.0.0 - 13.0.0",
    "iPadOS: 10.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKUIDelegate/webView(_:previewingViewControllerForElement:defaultActions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKUIDelegate(im)webView:previewingViewControllerForElement:defaultActions:"
  },
  "title" : "webView(_:previewingViewControllerForElement:defaultActions:)"
}
-->

# webView(_:previewingViewControllerForElement:defaultActions:)

Called when the user performs a peek action.

```
optional func webView(_ webView: WKWebView, previewingViewControllerForElement elementInfo: WKPreviewElementInfo, defaultActions previewActions: [any WKPreviewActionItem]) -> UIViewController?
```

## Parameters

`webView`

The web view invoking the delegate method.

`elementInfo`

The information associated with the element.

`previewActions`

An array of default actions used by the element.

## Return Value

Return `nil` to use Webkit’s default preview behavior. Returning a view controller allows [`webView(_:commitPreviewingViewController:)`](/documentation/WebKit/WKUIDelegate/webView(_:commitPreviewingViewController:)) to be invoked when the user performs a pop action.

## Discussion

To use the default actions, your app must return the actions to be run in your view controller’s implementation of <doc://com.apple.documentation/documentation/UIKit/UIViewController/previewActionItems>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)