---
title: BETextInput
framework: browserenginekit
role: symbol
role_heading: Protocol
path: browserenginekit/betextinput
---

# BETextInput

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

## Declaration

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

## Mentioned in

Integrating custom browser text views with UIKit Supporting extended text interactions

## Overview

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.

## Topics

### Managing the text input view

- [textInputView](browserenginekit/betextinput/textinputview.md)
- [unscaledView](browserenginekit/betextinput/unscaledview.md)
- [selectionClipRect](browserenginekit/betextinput/selectioncliprect.md)
- [unobscuredContentRect](browserenginekit/betextinput/unobscuredcontentrect.md)

### Managing selection

- [selectedText](browserenginekit/betextinput/selectedtext.md)
- [selectedTextRange](browserenginekit/betextinput/selectedtextrange.md)
- [isSelectionAtDocumentStart](browserenginekit/betextinput/isselectionatdocumentstart.md)
- [selectPosition(at:completionHandler:)](browserenginekit/betextinput/selectposition(at:completionhandler:).md)
- [selectPosition(at:for:completionHandler:)](browserenginekit/betextinput/selectposition(at:for:completionhandler:).md)
- [adjustSelection(by:completionHandler:)](browserenginekit/betextinput/adjustselection(by:completionhandler:).md)
- [updateCurrentSelection(to:from:in:)](browserenginekit/betextinput/updatecurrentselection(to:from:in:).md)

### Managing selection views

- [selectionContainerViewAboveText](browserenginekit/betextinput/selectioncontainerviewabovetext.md)
- [selectionContainerViewBelowText](browserenginekit/betextinput/selectioncontainerviewbelowtext.md)

### Managing marked text

- [hasMarkedText](browserenginekit/betextinput/hasmarkedtext.md)
- [markedTextRange](browserenginekit/betextinput/markedtextrange.md)
- [unmarkText()](browserenginekit/betextinput/unmarktext().md)
- [isPointNearMarkedText(_:)](browserenginekit/betextinput/ispointnearmarkedtext(_:).md)

### Inserting and replacing text

- [insert(_:)](browserenginekit/betextinput/insert(_:)-5iryn.md)
- [insert(_:)](browserenginekit/betextinput/insert(_:)-6x7hd.md)
- [replaceSelectedText(_:withText:)](browserenginekit/betextinput/replaceselectedtext(_:withtext:).md)
- [replaceDictatedText(_:withText:)](browserenginekit/betextinput/replacedictatedtext(_:withtext:).md)
- [add(_:)](browserenginekit/betextinput/add(_:).md)

### Deleting text

- [delete(in:to:)](browserenginekit/betextinput/delete(in:to:).md)

### Adjusting text

- [transposeCharactersAroundSelection()](browserenginekit/betextinput/transposecharactersaroundselection().md)
- [selectWordForReplacement()](browserenginekit/betextinput/selectwordforreplacement().md)

### Requesting context

- [requestDocumentContext(_:completionHandler:)](browserenginekit/betextinput/requestdocumentcontext(_:completionhandler:).md)
- [requestTextContextForAutocorrection(completionHandler:)](browserenginekit/betextinput/requesttextcontextforautocorrection(completionhandler:).md)
- [requestTextRects(for:withCompletionHandler:)](browserenginekit/betextinput/requesttextrects(for:withcompletionhandler:).md)

### Managing placeholders

- [insertTextPlaceholder(size:completionHandler:)](browserenginekit/betextinput/inserttextplaceholder(size:completionhandler:).md)

### Managing text traits

- [extendedTextInputTraits](browserenginekit/betextinput/extendedtextinputtraits.md)
- [isEditable](browserenginekit/betextinput/iseditable.md)

### Responding to keyboard input

- [shiftKeyStateChanged(fromState:toState:)](browserenginekit/betextinput/shiftkeystatechanged(fromstate:tostate:).md)

### Responding to dictation

- [didInsertFinalDictationResult()](browserenginekit/betextinput/didinsertfinaldictationresult().md)

### Managing the edit menu

- [selectTextForEditMenuWithLocation(inView:completionHandler:)](browserenginekit/betextinput/selecttextforeditmenuwithlocation(inview:completionhandler:).md)
- [canPerformAction(_:withSender:)](browserenginekit/betextinput/canperformaction(_:withsender:).md)

### Styling text

- [textStyling(at:in:)](browserenginekit/betextinput/textstyling(at:in:).md)

### Instance Properties

- [asyncInputDelegate](browserenginekit/betextinput/asyncinputdelegate.md)
- [attributedMarkedText](browserenginekit/betextinput/attributedmarkedtext.md)
- [automaticallyPresentEditMenu](browserenginekit/betextinput/automaticallypresenteditmenu.md)
- [isReplaceAllowed](browserenginekit/betextinput/isreplaceallowed.md)
- [markedText](browserenginekit/betextinput/markedtext.md)
- [textFirstRect](browserenginekit/betextinput/textfirstrect.md)
- [textLastRect](browserenginekit/betextinput/textlastrect.md)

### Instance Methods

- [adjustSelectionBoundary(to:touchPhase:baseIsStart:flags:)](browserenginekit/betextinput/adjustselectionboundary(to:touchphase:baseisstart:flags:).md)
- [alternativesForSelectedText()](browserenginekit/betextinput/alternativesforselectedtext().md)
- [autoscroll(to:)](browserenginekit/betextinput/autoscroll(to:).md)
- [cancelAutoscroll()](browserenginekit/betextinput/cancelautoscroll().md)
- [caretRect(for:)](browserenginekit/betextinput/caretrect(for:).md)
- [handleKeyEntry(_:completionHandler:)](browserenginekit/betextinput/handlekeyentry(_:completionhandler:).md)
- [keyboardWillDismiss()](browserenginekit/betextinput/keyboardwilldismiss().md)
- [move(byOffset:)](browserenginekit/betextinput/move(byoffset:).md)
- [moveSelection(atBoundary:in:completionHandler:)](browserenginekit/betextinput/moveselection(atboundary:in:completionhandler:).md)
- [offset(from:to:)](browserenginekit/betextinput/offset(from:to:).md)
- [remove(_:willInsertText:completionHandler:)](browserenginekit/betextinput/remove(_:willinserttext:completionhandler:).md)
- [removeTextAlternatives()](browserenginekit/betextinput/removetextalternatives().md)
- [replaceText(_:withText:options:completionHandler:)](browserenginekit/betextinput/replacetext(_:withtext:options:completionhandler:).md)
- [requestPreferredArrowDirectionForEditMenu(completionHandler:)](browserenginekit/betextinput/requestpreferredarrowdirectionforeditmenu(completionhandler:).md)
- [selectText(in:at:completionHandler:)](browserenginekit/betextinput/selecttext(in:at:completionhandler:).md)
- [selectionRects(for:)](browserenginekit/betextinput/selectionrects(for:).md)
- [setAttributedMarkedText(_:selectedRange:)](browserenginekit/betextinput/setattributedmarkedtext(_:selectedrange:).md)
- [setBaseWritingDirection(_:for:)](browserenginekit/betextinput/setbasewritingdirection(_:for:).md)
- [setMarkedText(_:selectedRange:)](browserenginekit/betextinput/setmarkedtext(_:selectedrange:).md)
- [setSelection(from:to:gesture:state:)](browserenginekit/betextinput/setselection(from:to:gesture:state:).md)
- [systemWillDismissEditMenu(withAnimator:)](browserenginekit/betextinput/systemwilldismisseditmenu(withanimator:).md)
- [systemWillPresentEditMenu(withAnimator:)](browserenginekit/betextinput/systemwillpresenteditmenu(withanimator:).md)
- [text(in:)](browserenginekit/betextinput/text(in:).md)
- [textInteractionGesture(_:shouldBeginAt:)](browserenginekit/betextinput/textinteractiongesture(_:shouldbeginat:).md)
- [updateSelection(extent:boundary:completionHandler:)](browserenginekit/betextinput/updateselection(extent:boundary:completionhandler:).md)
- [willInsertFinalDictationResult()](browserenginekit/betextinput/willinsertfinaldictationresult().md)

## Relationships

### Inherits From

- [BEResponderEditActions](browserenginekit/berespondereditactions.md)
- [BETextSelectionDirectionNavigation](browserenginekit/betextselectiondirectionnavigation.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [UIKeyInput](uikit/uikeyinput.md)
- [UIResponderStandardEditActions](uikit/uiresponderstandardeditactions.md)
- [UITextInputTraits](uikit/uitextinputtraits.md)

## See Also

### Custom text views

- [Integrating custom browser text views with UIKit](browserenginekit/integrating-custom-browser-text-views-with-uikit.md)
- [Supporting extended text interactions](browserenginekit/support-extended-text-interactions.md)
- [BETextInputDelegate](browserenginekit/betextinputdelegate.md)
