---
title: "webView(_:shouldEndEditingIn:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webeditingdelegate/webview(_:shouldendeditingin:)"
---

# webView(_:shouldEndEditingIn:)

Returns whether the user should be allowed to end editing.

## Declaration

```swift
optional func webView(_ webView: WebView!, shouldEndEditingIn range: DOMRange!) -> Bool
```

## Parameters

- `webView`: The web view that the user is editing.
- `range`: Typically, the current selection, although it might not be. Use the range parameter to help determine whether the user can end editing.

## Return Value

Return Value true if the user should be allowed to end editing webView; otherwise, false. If this method returnstrue, webView ends editing and resigns as the first responder.

## Discussion

Discussion This method is invoked when a web view attempts to resign as the first responder.

## See Also

### Related Documentation

- [webView(_:shouldBeginEditingIn:)](webkit/webeditingdelegate/webview(_:shouldbegineditingin:).md)
- [webViewDidEndEditing(_:)](webkit/webeditingdelegate/webviewdidendediting(_:).md)
