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

# subscript(_:)

Returns the object located at the specified index.

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

## Parameters

`idx`

An index within the bounds of the fetch result.

## Return Value

The object located at `index` in the fetch result.

## Discussion

Raises a range exception if `idx` is beyond the end of the fetch result (that is, greater than or equal to the value of the [`count`](/documentation/Photos/PHFetchResult/count) property).

This method behaves identically to the [`object(at:)`](/documentation/Photos/PHFetchResult/object(at:)) method and allows you to access a fetch result using subscript syntax. That is, the two statements below produce the same result.

```swift
print("First object \(fetchResult[0])")
print("First object \(fetchResult.object(at: 0))")
```

---

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)