IMKServerInput
IMKServerInput is an informal protocol that defines methods for receiving text events. This is intentionally not a formal protocol because there are three ways to receive events. An input method chooses one of the following approaches and implements the appropriate methods:
Overview
Key binding. In this approach the system tries to map each key-down event to an action method that the input method has implemented. If successful (action method found), the system calls
didCommandBySelector:client:. If unsuccessful (action method not found), the system callsinputText:client:. For this approach you need to implement inputText(_:client:) and didCommand(by:client:).Text data only. In this approach, you opt to receive all key events without the key binding, and then unpack the relevant text data. Key events are broken down into the Unicodes, the key code that generated them, and modifier flags. This data is then sent to the inputText(_:key:modifiers:client:) method, which you need to implement.
Handle all events. In this approach, you receive events directly from the Text Services Manager as NSEvent objects. You must implement handle(_:client:) method.