---
title: UIKey
framework: uikit
role: symbol
role_heading: Class
path: uikit/uikey
---

# UIKey

An object that provides information about the state of a keyboard key.

## Declaration

```swift
@MainActor class UIKey
```

## Overview

Overview UIKey provides relevant information about the current state of a key on a keyboard as a user presses and releases the key. To learn more, see Handling key presses made on a physical keyboard.

## Topics

### Determining key type

- [keyCode](uikit/uikey/keycode.md)
- [modifierFlags](uikit/uikey/modifierflags.md)

### Getting key characters

- [characters](uikit/uikey/characters.md)
- [charactersIgnoringModifiers](uikit/uikey/charactersignoringmodifiers.md)

### Initializers

- [init(coder:)](uikit/uikey/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)

## See Also

### Physical keyboards

- [Handling key presses made on a physical keyboard](uikit/handling-key-presses-made-on-a-physical-keyboard.md)
- [Navigating an app’s user interface using a keyboard](uikit/navigating-an-app-s-user-interface-using-a-keyboard.md)
- [Adding hardware keyboard support to your app](uikit/adding-hardware-keyboard-support-to-your-app.md)
- [UIKeyboardHIDUsage](uikit/uikeyboardhidusage.md)
