---
title: eventRef
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsevent/eventref
---

# eventRef

An opaque Carbon type associated with this event.

## Declaration

```swift
var eventRef: UnsafeRawPointer? { get }
```

## Discussion

Discussion This method is valid for all types of events. The EventRef object is retained by the receiver, so it is valid as long as the NSEvent object is valid, and is released when the NSEvent object is freed. You can use RetainEvent(_:) to extend the lifetime of the EventRef object, with a corresponding ReleaseEvent(_:) when you are done with it. The system typically creates user-input events with an associated EventRef. Other NSEvent objects create an EventRef when this property is first accessed, if possible. If there is no equivalent NSEvent for this event, the property is set to NULL.

## See Also

### Related Documentation

- [init(eventRef:)](appkit/nsevent/init(eventref:).md)

### Getting general event information

- [locationInWindow](appkit/nsevent/locationinwindow.md)
- [timestamp](appkit/nsevent/timestamp.md)
- [window](appkit/nsevent/window.md)
- [windowNumber](appkit/nsevent/windownumber.md)
- [cgEvent](appkit/nsevent/cgevent.md)
- [foreverDuration](appkit/nsevent/foreverduration.md)
