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

# BETextInput

A protocol for asynchronous text views that integrate with the text system.

```
protocol BETextInput : BEResponderEditActions, BETextSelectionDirectionNavigation, UIKeyInput
```

## Overview

Adopt this protocol in a text field to perform asynchronous actions and provide information to the text system. For example, you can make an XPC request to a web content extension. See [Integrating custom browser text views with UIKit](/documentation/BrowserEngineKit/integrating-custom-browser-text-views-with-uikit).

## Topics

### Managing the text input view

[`textInputView`](/documentation/BrowserEngineKit/BETextInput/textInputView)

An affiliated view that provides a coordinate system for all geometric values in this protocol.

[`unscaledView`](/documentation/BrowserEngineKit/BETextInput/unscaledView)

A view that represents the web content that’s agnostic of zoom state.

[`selectionClipRect`](/documentation/BrowserEngineKit/BETextInput/selectionClipRect)

A rectangle that represents the bounds of editable elements.

[`unobscuredContentRect`](/documentation/BrowserEngineKit/BETextInput/unobscuredContentRect)

A rectangle that frames a user interface, such as text-selection handles, in an unobscured location.

### Managing selection

[`selectedText`](/documentation/BrowserEngineKit/BETextInput/selectedText)

A string that represents the selected text.

[`selectedTextRange`](/documentation/BrowserEngineKit/BETextInput/selectedTextRange)

A range that represents the selected text.

[`isSelectionAtDocumentStart`](/documentation/BrowserEngineKit/BETextInput/isSelectionAtDocumentStart)

A Boolean value that indicates if the current selection is at the beginning of the document.

[`selectPosition(at:completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/selectPosition(at:completionHandler:))

Sets the selection caret to the given point.

[`selectPosition(at:for:completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/selectPosition(at:for:completionHandler:))

Sets the selection caret to the given point.

[`adjustSelection(by:completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/adjustSelection(by:completionHandler:))

Adjusts the selection using a range.

[`updateCurrentSelection(to:from:in:)`](/documentation/BrowserEngineKit/BETextInput/updateCurrentSelection(to:from:in:))

Indicates the point where the text interaction gesture changes.

### Managing selection views

[`selectionContainerViewAboveText`](/documentation/BrowserEngineKit/BETextInput/selectionContainerViewAboveText)

An optional view you supply to draw text selection above the text.

[`selectionContainerViewBelowText`](/documentation/BrowserEngineKit/BETextInput/selectionContainerViewBelowText)

An optional view you supply to draw text selection below the text.

### Managing marked text

[`hasMarkedText`](/documentation/BrowserEngineKit/BETextInput/hasMarkedText)

A Boolean value that indicates if marked text exists for an active input session.

[`markedTextRange`](/documentation/BrowserEngineKit/BETextInput/markedTextRange)

A range that represents the position of the marked text.

[`unmarkText()`](/documentation/BrowserEngineKit/BETextInput/unmarkText())

Unmarks the currently marked text.

[`isPointNearMarkedText(_:)`](/documentation/BrowserEngineKit/BETextInput/isPointNearMarkedText(_:))

Provides a Boolean value that indicates if a point is near marked text.

### Inserting and replacing text

[`insert(_:)`](/documentation/BrowserEngineKit/BETextInput/insert(_:)-5iryn)

Inserts a text suggestion in response to a suggestion selection.

[`insert(_:)`](/documentation/BrowserEngineKit/BETextInput/insert(_:)-6x7hd)

Inserts the given text or one of the available alternatives.

[`replaceSelectedText(_:withText:)`](/documentation/BrowserEngineKit/BETextInput/replaceSelectedText(_:withText:))

Replaces text with new text, either within the current selection or near the cursor.

[`replaceDictatedText(_:withText:)`](/documentation/BrowserEngineKit/BETextInput/replaceDictatedText(_:withText:))

Replaces the specified text for the text of a dictation.

[`add(_:)`](/documentation/BrowserEngineKit/BETextInput/add(_:))

Adds text alternatives to the text input object for the current selection.

### Deleting text

[`delete(in:to:)`](/documentation/BrowserEngineKit/BETextInput/delete(in:to:))

Deletes the specified amount of text.

### Adjusting text

[`transposeCharactersAroundSelection()`](/documentation/BrowserEngineKit/BETextInput/transposeCharactersAroundSelection())

Transposes the characters on either side of the caret.

[`selectWordForReplacement()`](/documentation/BrowserEngineKit/BETextInput/selectWordForReplacement())

Selects a tapped word with autocorrect suggestions.

### Requesting context

[`requestDocumentContext(_:completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/requestDocumentContext(_:completionHandler:))

Gathers context for the system about the current document.

[`requestTextContextForAutocorrection(completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/requestTextContextForAutocorrection(completionHandler:))

A method the text system calls to get extra information for autocorrection suggestions.

[`requestTextRects(for:withCompletionHandler:)`](/documentation/BrowserEngineKit/BETextInput/requestTextRects(for:withCompletionHandler:))

Gathers context for the presentation of a text-related user interface.

### Managing placeholders

[`insertTextPlaceholder(size:completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/insertTextPlaceholder(size:completionHandler:))

Inserts a placeholder object to reserve visual space during text input.

### Managing text traits

[`extendedTextInputTraits`](/documentation/BrowserEngineKit/BETextInput/extendedTextInputTraits)

An object that customizes text-input appearance and behavior beyond the standard system traits.

[`isEditable`](/documentation/BrowserEngineKit/BETextInput/isEditable)

A Boolean value that determines the ability to modify text.

### Responding to keyboard input

[`shiftKeyStateChanged(fromState:toState:)`](/documentation/BrowserEngineKit/BETextInput/shiftKeyStateChanged(fromState:toState:))

Indicates a transition in the state of the Shift key.

### Responding to dictation

[`didInsertFinalDictationResult()`](/documentation/BrowserEngineKit/BETextInput/didInsertFinalDictationResult())

A Boolean value that indicates when the system inserts a dictation result.

### Managing the edit menu

[`selectTextForEditMenuWithLocation(inView:completionHandler:)`](/documentation/BrowserEngineKit/BETextInput/selectTextForEditMenuWithLocation(inView:completionHandler:))

Indicates the edit menu displays at the given location in the text input view’s coordinate space.

[`canPerformAction(_:withSender:)`](/documentation/BrowserEngineKit/BETextInput/canPerformAction(_:withSender:))

Indicates whether the text view can process a given action.

### Styling text

[`textStyling(at:in:)`](/documentation/BrowserEngineKit/BETextInput/textStyling(at:in:))

Provides a dictionary that customizes the appearance of strings.



---

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)