---
title: "subscript(_:)"
framework: gamecontroller
role: symbol
role_heading: Instance Subscript
path: "gamecontroller/gcdevicephysicalinputstate/subscript(_:)"
---

# subscript(_:)

Returns the element that the key specifies.

## Declaration

```swift
subscript(key: String) -> (any GCPhysicalInputElement)? { get }
```

## Parameters

- `key`: A key that identifies an element.

## Return Value

Return Value The element that matches the key.

## See Also

### Accessing elements

- [elements](gamecontroller/gcdevicephysicalinputstate/elements-46hgy.md)
- [axes](gamecontroller/gcdevicephysicalinputstate/axes-5u1xr.md)
- [buttons](gamecontroller/gcdevicephysicalinputstate/buttons-2ovae.md)
- [dpads](gamecontroller/gcdevicephysicalinputstate/dpads-7b4o3.md)
- [switches](gamecontroller/gcdevicephysicalinputstate/switches-6dcny.md)
