---
title: "postEvent(_:atStart:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsapplication/postevent(_:atstart:)"
---

# postEvent(_:atStart:)

Adds a given event to the receiver’s event queue.

## Declaration

```swift
func postEvent(_ event: NSEvent, atStart: Bool)
```

## Parameters

- `event`: The event object to post to the queue.
- `atStart`: Specify doc://com.apple.documentation/documentation/Swift/true to add the event to the front of the queue; otherwise, specify doc://com.apple.documentation/documentation/Swift/false to add the event to the back of the queue.

## Discussion

Discussion This method can also be called in subthreads. Events posted in subthreads bubble up in the main thread event queue.

## See Also

### Managing the event loop

- [nextEvent(matching:until:inMode:dequeue:)](appkit/nsapplication/nextevent(matching:until:inmode:dequeue:).md)
- [discardEvents(matching:before:)](appkit/nsapplication/discardevents(matching:before:).md)
- [currentEvent](appkit/nsapplication/currentevent.md)
- [isRunning](appkit/nsapplication/isrunning.md)
- [run()](appkit/nsapplication/run().md)
- [finishLaunching()](appkit/nsapplication/finishlaunching().md)
- [stop(_:)](appkit/nsapplication/stop(_:).md)
- [sendEvent(_:)](appkit/nsapplication/sendevent(_:).md)
