---
title: WKUIDelegate
framework: webkit
role: symbol
role_heading: Protocol
path: webkit/wkuidelegate
---

# WKUIDelegate

The methods for presenting native user interface elements on behalf of a webpage.

## Declaration

```swift
@MainActor protocol WKUIDelegate : NSObjectProtocol
```

## Overview

Overview Web view user interface delegates implement this protocol to control the opening of new windows, augment the behavior of default menu items displayed when the user clicks elements, and perform other user interface-related tasks. These methods can be invoked as a result of handling JavaScript or other plug-in content. The default web view implementation assumes one window per web view, so nonconventional user interfaces might implement a user interface delegate.

## Topics

### Creating and closing the web view

- [webView(_:createWebViewWith:for:windowFeatures:)](webkit/wkuidelegate/webview(_:createwebviewwith:for:windowfeatures:).md)
- [webViewDidClose(_:)](webkit/wkuidelegate/webviewdidclose(_:).md)

### Displaying UI panels

- [webView(_:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)](webkit/wkuidelegate/webview(_:runjavascriptalertpanelwithmessage:initiatedbyframe:completionhandler:).md)
- [webView(_:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)](webkit/wkuidelegate/webview(_:runjavascriptconfirmpanelwithmessage:initiatedbyframe:completionhandler:).md)
- [webView(_:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)](webkit/wkuidelegate/webview(_:runjavascripttextinputpanelwithprompt:defaulttext:initiatedbyframe:completionhandler:).md)
- [webView(_:showLockdownModeFirstUseMessage:completionHandler:)](webkit/wkuidelegate/webview(_:showlockdownmodefirstusemessage:completionhandler:).md)
- [WKDialogResult](webkit/wkdialogresult.md)

### Displaying an upload panel

- [webView(_:runOpenPanelWith:initiatedByFrame:completionHandler:)](webkit/wkuidelegate/webview(_:runopenpanelwith:initiatedbyframe:completionhandler:).md)
- [WKOpenPanelParameters](webkit/wkopenpanelparameters.md)

### Displaying a contextual menu

- [Adding context menus in your app](uikit/adding-context-menus-in-your-app.md)
- [webView(_:contextMenuConfigurationForElement:completionHandler:)](webkit/wkuidelegate/webview(_:contextmenuconfigurationforelement:completionhandler:).md)
- [webView(_:contextMenuForElement:willCommitWithAnimator:)](webkit/wkuidelegate/webview(_:contextmenuforelement:willcommitwithanimator:).md)
- [webView(_:contextMenuWillPresentForElement:)](webkit/wkuidelegate/webview(_:contextmenuwillpresentforelement:).md)
- [webView(_:contextMenuDidEndForElement:)](webkit/wkuidelegate/webview(_:contextmenudidendforelement:).md)
- [UIContextMenuConfiguration](uikit/uicontextmenuconfiguration.md)

### Displaying an edit menu

- [webView(_:willDismissEditMenuWithAnimator:)](webkit/wkuidelegate/webview(_:willdismisseditmenuwithanimator:).md)
- [webView(_:willPresentEditMenuWithAnimator:)](webkit/wkuidelegate/webview(_:willpresenteditmenuwithanimator:).md)

### Requesting permissions

- [webView(_:requestDeviceOrientationAndMotionPermissionFor:initiatedByFrame:decisionHandler:)](webkit/wkuidelegate/webview(_:requestdeviceorientationandmotionpermissionfor:initiatedbyframe:decisionhandler:).md)
- [webView(_:requestMediaCapturePermissionFor:initiatedByFrame:type:decisionHandler:)](webkit/wkuidelegate/webview(_:requestmediacapturepermissionfor:initiatedbyframe:type:decisionhandler:).md)
- [WKPermissionDecision](webkit/wkpermissiondecision.md)
- [WKMediaCaptureType](webkit/wkmediacapturetype.md)

### Deprecated

- [Deprecated symbols](webkit/wkuidelegate-deprecated-symbols.md)

### Instance Methods

- [webView(_:insertInputSuggestion:)](webkit/wkuidelegate/webview(_:insertinputsuggestion:).md)
- [webView(_:requestGeolocationPermissionFor:initiatedByFrame:decisionHandler:)](webkit/wkuidelegate/webview(_:requestgeolocationpermissionfor:initiatedbyframe:decisionhandler:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Web views

- [Replacing UIWebView in your app](webkit/replacing-uiwebview-in-your-app.md)
- [Viewing Desktop or Mobile Web Content Using a Web View](webkit/viewing-desktop-or-mobile-web-content-using-a-web-view.md)
- [WKWebView](webkit/wkwebview.md)
