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

# handleKeyEntry(_:completionHandler:)

Accepts key-entry events from the text system for the text view to process.

```
func handleKeyEntry(_ entry: BEKeyEntry, completionHandler: @escaping @Sendable (BEKeyEntry, Bool) -> Void)
```

```
func handleKeyEntry(_ entry: BEKeyEntry) async -> (BEKeyEntry, Bool)
```

## Parameters

`entry`

The keyboard event delivered by the system.

`completionHandler`

A block that you call to indicate whether your text view handled the event.

## Discussion

Implement this method to receive keyboard events from the system.
If you handle the `entry` in code, call the completion handler with `true` as the second parameter.
Otherwise, call the completion handler with `false` as the second argument, and call the delegate’s [`shouldDeferEventHandlingToSystem(for:context:)`](/documentation/BrowserEngineKit/BETextInputDelegate/shouldDeferEventHandlingToSystem(for:context:)) method.
In either case, pass the `entry` you received as the first parameter to the completion handler.

The system delivers events on a serial queue, so call the completion handler after your view processes an event to allow the system to send a subsequent event.

---

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)