<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSEvent/cgEvent",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSEvent(py)CGEvent"
  },
  "title" : "cgEvent"
}
-->

# cgEvent

The Core Graphics event object corresponding to this event.

```
var cgEvent: CGEvent? { get }
```

## Discussion

The <doc://com.apple.documentation/documentation/CoreGraphics/CGEvent> opaque type returned is autoreleased. If no `CGEventRef` object corresponding to the `NSEvent` object can be created, this method returns `NULL`.

## See Also

[`init(cgEvent:)`](/documentation/AppKit/NSEvent/init(cgEvent:)-4igjn)

Creates and returns an event object for a Core Graphics event.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)