Contents

characters(byApplyingModifiers:)

Returns the new characters that result if you apply the specified modifier keys to the event.

Declaration

func characters(byApplyingModifiers modifiers: NSEvent.ModifierFlags) -> String?

Parameters

  • modifiers:

    The modifier keys you want to apply to the event’s characters. These modifiers completely replace the existing modifiers in the event.

Return Value

The characters that result from the application of the specified modifier keys. If the event contains invalid data, this method returns nil.

Discussion

Call this method to determine what characters occur if you apply the specified modifier keys to this event. This method doesn’t modify the event itself, but returns a translation of the event’s data that replaces the existing modifier keys with the new ones you specify. Cal this method only for an event of type NSEvent.EventType.keyUp or NSEvent.EventType.keyDown.

See Also

Getting key event information