<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameController",
  "identifier" : "/documentation/GameController/GCKeyboardInput",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Game Controller"
    ],
    "preciseIdentifier" : "c:objc(cs)GCKeyboardInput"
  },
  "title" : "GCKeyboardInput"
}
-->

# GCKeyboardInput

A controller profile that uses the keyboard as the input device.

```
class GCKeyboardInput
```

## Overview

Use this profile to get the state of the keyboard buttons that the [`GCKeyCode`](/documentation/GameController/GCKeyCode) structure defines.

## Topics

### Getting Change Information

[`keyChangedHandler`](/documentation/GameController/GCKeyboardInput/keyChangedHandler)

The block that the profile calls when the user presses a key.

[`GCKeyboardValueChangedHandler`](/documentation/GameController/GCKeyboardValueChangedHandler)

The signature for the block that the keyboard input profile calls when a key value changes.

### Accessing Buttons

[`isAnyKeyPressed`](/documentation/GameController/GCKeyboardInput/isAnyKeyPressed)

A Boolean value that indicates whether the user is pressing any of the keys.

[`button(forKeyCode:)`](/documentation/GameController/GCKeyboardInput/button(forKeyCode:))

Returns the button element for the specified key code.

[`GCKeyCode`](/documentation/GameController/GCKeyCode)

The key codes for keys on a keyboard.

[Keycode Constants](/documentation/GameController/keycode-constants)

Constants for the codes of keyboard keys.



---

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)