Instance Method

nextEvent(matching:)

Returns the next event matching a given mask.

Declaration

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

Parameters

mask

The mask that the event to return must match. Events with non-matching masks are left in the queue. See discardEvents(matching:before:) in NSApplication for the list of mask values.

Return Value

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

Discussion

This method calls the nextEvent(matching:until:inMode:dequeue:) method, where the matching mask parameter is the specified mask, the until parameter is distantFuture, the inMode parameter is eventTracking, and the dequeue parameter is true.

See Also

Handling Events

class func menuChanged(NSMenu)

This method does nothing; it is here for backward compatibility.

Deprecated
var currentEvent: NSEvent?

The event currently being processed by the application.

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.