<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSApplication/sendEvent(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSApplication(im)sendEvent:"
  },
  "title" : "sendEvent(_:)"
}
-->

# sendEvent(_:)

Dispatches an event to other objects.

```
func sendEvent(_ event: NSEvent)
```

## Parameters

`event`

The event object to dispatch.

## Discussion

You rarely invoke [`sendEvent(_:)`](/documentation/AppKit/NSApplication/sendEvent(_:)) directly, although you might want to override this method to perform some action on every event. [`sendEvent(_:)`](/documentation/AppKit/NSApplication/sendEvent(_:)) messages are sent from the main event loop (the [`run()`](/documentation/AppKit/NSApplication/run()) method). [`sendEvent(_:)`](/documentation/AppKit/NSApplication/sendEvent(_:)) is the method that dispatches events to the appropriate responders—`NSApp` handles app events, the [`NSWindow`](/documentation/AppKit/NSWindow) object indicated in the event record handles window-related events, and mouse and key events are forwarded to the appropriate [`NSWindow`](/documentation/AppKit/NSWindow) object for further dispatching.

---

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)