KeyEventArgs

public class KeyEventArgs

The arguments for a keyboard event that is forwarded to event listeners.

  • The actual realized key code of the key press.

    Declaration

    Swift

    public let keyCode: Keys
  • If the key event has an associated textual character, such as an alphabetical letter of digit, this value is set to that textual representation.

    Declaration

    Swift

    public let keyChar: String?
  • Any modifier that was pressed along with the rest of the input described by this event.

    Declaration

    Swift

    public let modifiers: KeyboardModifier
  • Whether this event was handled by a responder in the first responder chain.

    Event handlers can set this value to true to indicate that upstream control systems that forwarded the event should treat the event as handled and not respond to it themselves.

    Declaration

    Swift

    public var handled: Bool
  • Initializes a new key event argument structure. handled is set to false by default.

    Declaration

    Swift

    public init(keyCode: Keys, keyChar: String?, modifiers: KeyboardModifier)
  • Creates a copy of this event, modifying the return value’s keyCode to a specified value.

    Declaration

    Swift

    public func withKeyCode(_ keyCode: Keys) -> KeyEventArgs
  • Creates a copy of this event, modifying the return value’s keyChar to a specified value.

    Declaration

    Swift

    public func withKeyChar(_ keyChar: String?) -> KeyEventArgs
  • Creates a copy of this event, modifying the return value’s modifiers to a specified value.

    Declaration

    Swift

    public func withModifiers(_ modifiers: KeyboardModifier) -> KeyEventArgs