Contents

handleKeyEntry(_:completionHandler:)

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

Declaration

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.

Mentioned in

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:) 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.