Initializer

init(cgEvent:)

Creates and returns an event object that is based on a Core Graphics type of event.

Declaration

init?(cgEvent: CGEvent)

Parameters

cgEvent

A CGEvent opaque type that represents an event.

Return Value

An autoreleased NSEvent object that is equivalent to cgEvent.

Discussion

The returned object retains the CGEventRef object (cgEvent) until it (the Objective-C object) is freed—it then releases the CGEventRef object. If no Cocoa event corresponds to the CGEventRef object, this method returns nil.

See Also