Represents the virtual key codes used in keyboard events.
- macOS 10.0+
- Mac Catalyst 13.0+
- Core Graphics
In macOS, the hardware scan codes generated by keyboards are mapped to a set of virtual key codes that are hardware-independent. Pressing a given key always generates the same virtual key code on any supported keyboard.
As keys are pressed, the system uses the virtual key codes to create low-level keyboard events. For information on how to simulate a keyboard event, see the function