<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSIndexPath/getIndexes(_:range:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSIndexPath(im)getIndexes:range:"
  },
  "title" : "getIndexes(_:range:)"
}
-->

# getIndexes(_:range:)

Copies the indexes stored in the index path from the positions specified by the position range into the specified indexes.

```
func getIndexes(_ indexes: UnsafeMutablePointer<Int>, range positionRange: NSRange)
```

## Parameters

`indexes`

Pointer to a C array of at least as many <doc://com.apple.documentation/documentation/ObjectiveC/NSUInteger> objects as specified by the length of `positionRange`. On return, the array holds the index path’s indexes.

`positionRange`

A range of valid positions within the index path. If the location plus the length of `positionRange` is greater than the length of the index path, this method raises an [`rangeException`](/documentation/Foundation/NSExceptionName/rangeException).

## Discussion

You must allocate the memory for the C array.

---

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)