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

# subscript(_:)

Returns the element that the key specifies.

## Declaration

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

## Parameters

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

## Return Value

Return Value The element that matches the key.

## Discussion

Discussion You can access elements of a profile using a subscript notation. For example, get the button with the X label from an instance of GCMicroGamepad using microGamepad[”Button X”].

## See Also

### Accessing elements by name or key

- [elements](gamecontroller/gcphysicalinputprofile/elements.md)
- [buttons](gamecontroller/gcphysicalinputprofile/buttons.md)
- [axes](gamecontroller/gcphysicalinputprofile/axes.md)
- [dpads](gamecontroller/gcphysicalinputprofile/dpads.md)
- [touchpads](gamecontroller/gcphysicalinputprofile/touchpads.md)
