<!--
{
  "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/requestTextContextForAutocorrection(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "BrowserEngineKit"
    ],
    "preciseIdentifier" : "c:objc(pl)BETextInput(im)requestTextContextForAutocorrectionWithCompletionHandler:"
  },
  "title" : "requestTextContextForAutocorrection(completionHandler:)"
}
-->

# requestTextContextForAutocorrection(completionHandler:)

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

```
func requestTextContextForAutocorrection(completionHandler: @escaping @Sendable (BETextDocumentContext) -> Void)
```

```
func requestTextContextForAutocorrection() async -> BETextDocumentContext
```

## Parameters

`completionHandler`

A closure that you call to supply the context as a [`BETextDocumentContext`](/documentation/BrowserEngineKit/BETextDocumentContext).

## Discussion

The system calls this method to retrieve extra context for the currently selected text.

Construct a [`BETextDocumentContext`](/documentation/BrowserEngineKit/BETextDocumentContext) that contains complete sentences that also include the current selection. If the selection is at a sentence boundary, also include the preceding sentence.

---

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)