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

# webView(_:shouldBeginEditingIn:)

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

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

## Parameters

`webView`

The web view that the user is editing.

`range`

The section of the begin-editing request; used to determine if editing is allowed. Typically, `range` is not the current selection but may becomes the current selection if this method returns <doc://com.apple.documentation/documentation/Swift/true>.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the user is allowed to edit `webView`; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method is invoked when a web view attempts to become the first responder or when the user drops an object on it.

## See Also

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

Returns whether the user should be allowed to end editing.

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

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