---
title: "subscript(_:)"
framework: realitykit
role: symbol
role_heading: Instance Subscript
path: "realitykit/entity/componentset/subscript(_:)-5wdsf"
---

# subscript(_:)

Gets or sets the component of the specified type.

## Declaration

```swift
@abi(@MainActor @preconcurrency subscript<T>(optimized componentType: T.Type) -> T? where T : Component { get set }) @MainActor @preconcurrency subscript<T>(componentType: T.Type) -> T? where T : Component { get set }
```

## See Also

### Accessing members

- [subscript(_:)](realitykit/entity/componentset/subscript(_:)-47rhg.md)
