<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -",
    "tvOS: 17.4.0 -",
    "visionOS: 1.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BrowserEngineKit",
  "identifier" : "/documentation/BrowserEngineKit/BEResponderEditActions/replace(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "BrowserEngineKit"
    ],
    "preciseIdentifier" : "c:objc(pl)BEResponderEditActions(im)replace:"
  },
  "title" : "replace(_:)"
}
-->

# replace(_:)

Removes the selected text and inputs the chosen replacement text.

```
optional func replace(_ sender: Any?)
```

## Parameters

`sender`

The object calling this method.

## Discussion

To invoke the standard system behavior for replacing text, call [`textInput(_:deferReplaceTextActionToSystem:)`](/documentation/BrowserEngineKit/BETextInputDelegate/textInput(_:deferReplaceTextActionToSystem:)) in your implementation of this method.

---

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)