Instance Method


Forwards the message to the global NSApplication object, NSApp.


func nextEvent(matching mask: NSEvent.EventTypeMask, until expiration: Date?, inMode mode: RunLoop.Mode, dequeue deqFlag: Bool) -> NSEvent?



The mask that the event to return must match.


The date until which to wait for events.


The run loop mode to use while waiting for events


true to remove the returned event from the event queue; false to leave the returned event in the queue.

Return Value

The next event whose mask matches the specified mask; nil when no matching event was found.

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 sendEvent(NSEvent)

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

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

Dispatches action messages with a given argument.