Instance Method


This action method dispatches mouse and keyboard events sent to the window by the NSApplication object.


func sendEvent(_ event: NSEvent)



The mouse or keyboard event to process.


Never invoke this method directly. A right mouse-down event in a window of an inactive application is not delivered to the corresponding NSWindow object. It is instead delivered to the NSApplication object through a sendEvent(_:) message with a window number of 0.

See Also

Handling Events

var currentEvent: NSEvent?

The event currently being processed by the application.

func nextEvent(matching: NSEvent.EventTypeMask) -> NSEvent?

Returns the next event matching a given mask.

func discardEvents(matching: NSEvent.EventTypeMask, before: NSEvent?)

Forwards the message to the NSApplication object, NSApp.

func postEvent(NSEvent, atStart: Bool)

Forwards the message to the global NSApplication object, NSApp.

func tryToPerform(Selector, with: Any?) -> Bool

Dispatches action messages with a given argument.