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

# webViewDidChangeSelection(_:)

Sent by the default notification center when the user changes the selection in the web view.

```
optional func webViewDidChangeSelection(_ notification: Notification!)
```

## Parameters

`notification`

Always set to [`WebViewDidChangeSelectionNotification`](/documentation/WebKit/WebViewDidChangeSelectionNotification). You can retrieve the `WebView` object by sending `object` to `notification`.

## See Also

[`webView(_:shouldChangeSelectedDOMRange:to:affinity:stillSelecting:)`](/documentation/WebKit/WebEditingDelegate/webView(_:shouldChangeSelectedDOMRange:to:affinity:stillSelecting:))

Returns whether the user should be allowed to change the selected range.



---

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)