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

# webView(_:shouldDelete:)

Returns whether the user should be allowed to delete a range of content.

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

## Parameters

`webView`

The web view that the user is editing.

`range`

The range of the content to delete.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the user should be allowed to delete the content specified by `range`; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method may perform an alternate action—for example, delete a different range—and return <doc://com.apple.documentation/documentation/Swift/false>.

## See Also

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

Sent by the default notification center when the user changes content in 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)