---
title: KeyPress
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/keypress
---

# KeyPress

## Declaration

```swift
struct KeyPress
```

## Topics

### Getting the keypress

- [key](swiftui/keypress/key.md)
- [characters](swiftui/keypress/characters.md)
- [modifiers](swiftui/keypress/modifiers.md)

### Getting the phase of the keypress

- [phase](swiftui/keypress/phase.md)
- [KeyPress.Phases](swiftui/keypress/phases.md)

### Getting the result

- [KeyPress.Result](swiftui/keypress/result.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [Escapable](swift/escapable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Responding to keyboard input

- [onKeyPress(_:action:)](swiftui/view/onkeypress(_:action:).md)
- [onKeyPress(phases:action:)](swiftui/view/onkeypress(phases:action:).md)
- [onKeyPress(_:phases:action:)](swiftui/view/onkeypress(_:phases:action:).md)
- [onKeyPress(characters:phases:action:)](swiftui/view/onkeypress(characters:phases:action:).md)
- [onKeyPress(keys:phases:action:)](swiftui/view/onkeypress(keys:phases:action:).md)
