init(cgEvent:)
Creates and returns an event object for a Core Graphics 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
Related Documentation
Creating an event object
keyEvent(with:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:)mouseEvent(with:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:)enterExitEvent(with:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:)otherEvent(with:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:)init(eventRef:)