<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebEditingDelegate/webView(_:shouldEndEditingIn:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WebEditingDelegate(im)webView:shouldEndEditingInDOMRange:"
  },
  "title" : "webView(_:shouldEndEditingIn:)"
}
-->

# webView(_:shouldEndEditingIn:)

Returns whether the user should be allowed to end editing.

```
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

<doc://com.apple.documentation/documentation/Swift/true> if the user should be allowed to end editing `webView`; otherwise, <doc://com.apple.documentation/documentation/Swift/false>. If this method returns<doc://com.apple.documentation/documentation/Swift/true>, `webView` ends editing and resigns as the first responder.

## Discussion

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

## See Also

[`webView(_:shouldBeginEditingIn:)`](/documentation/WebKit/WebEditingDelegate/webView(_:shouldBeginEditingIn:))

Returns whether the user is allowed to edit a range of content in a web view.

[`webViewDidEndEditing(_:)`](/documentation/WebKit/WebEditingDelegate/webViewDidEndEditing(_:))

Sent by the default notification center when the user stops editing the web view.



---

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)