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

# keyDown(with:)

Informs the receiver that the user has pressed a key.

```
func keyDown(with event: NSEvent)
```

## Parameters

`event`

An object encapsulating information about the key-down event.

## Discussion

The receiver can interpret `event` itself, or pass it to the system input manager using [`interpretKeyEvents(_:)`](/documentation/AppKit/NSResponder/interpretKeyEvents(_:)). The default implementation simply passes this message to the next responder.

---

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)