Contents

keyState(_:key:)

Returns a Boolean value indicating the current keyboard state of a Quartz event source.

Declaration

class func keyState(_ stateID: CGEventSourceStateID, key: CGKeyCode) -> Bool

Parameters

  • stateID:

    The source state to access. Pass one of the constants listed in Cgeventsourcestateid.

  • key:

    The virtual key code to test.

Return Value

If true, the key is down. If false, the key is up.

See Also

Functions