---
title: "webViewDidClose(_:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkuidelegate/webviewdidclose(_:)"
---

# webViewDidClose(_:)

Notifies your app that the DOM window closed successfully.

## Declaration

```swift
optional func webViewDidClose(_ webView: WKWebView)
```

## Parameters

- `webView`: The web view invoking the delegate method.

## Discussion

Discussion Your app should remove the web view from the view hierarchy and update the UI as needed, for instance by closing the containing browser tab or window.

## See Also

### Creating and closing the web view

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