<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKComponentSystem/subscript(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Subscript",
  "symbol" : {
    "kind" : "Instance Subscript",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKComponentSystem(im)objectAtIndexedSubscript:"
  },
  "title" : "subscript(_:)"
}
-->

# subscript(_:)

Returns the component at the specified index in the system’s list of components.

```
subscript(idx: Int) -> ComponentType { get }
```

## Parameters

`idx`

A valid index to the [`components`](/documentation/GameplayKit/GKComponentSystem/components) array.

## Return Value

The component at the specified index in the [`components`](/documentation/GameplayKit/GKComponentSystem/components) array.

## Discussion

This method is equivalent to accessing objects by index in the [`components`](/documentation/GameplayKit/GKComponentSystem/components) array, but allows access using subscript syntax on the component system itself.

---

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)