<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/XPCArray/subscript(_:as:)-6grs4",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Subscript",
  "symbol" : {
    "kind" : "Instance Subscript",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "s:3XPC8XPCArrayV_2asxSgSi_xmtcSzRzluip"
  },
  "title" : "subscript(_:as:)"
}
-->

# subscript(_:as:)

Reads and writes the value at the given index as an integer value.

```
subscript<T>(index: Int, as type: T.Type = T.self) -> T? where T : BinaryInteger { get }
```

## Parameters

`index`

The position of the element to access.

`type`

The expected type for the returned value.

## Return Value

The value at the specified index in the array, otherwise <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0>.

---

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)