<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSIndexPath/init(indexes:length:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSIndexPath(im)initWithIndexes:length:"
  },
  "title" : "init(indexes:length:)"
}
-->

# init(indexes:length:)

Initializes an index path with the given nodes and length.

```
init(indexes: UnsafePointer<Int>?, length: Int)
```

## Parameters

`indexes`

Array of indexes to make up the index path.

`length`

Number of nodes to include in the index path.

## Return Value

Initialized [`NSIndexPath`](/documentation/Foundation/NSIndexPath) object with `indexes` up to `length`.

## Discussion

This method is a designated initializer of [`NSIndexPath`](/documentation/Foundation/NSIndexPath).

## See Also

[`+  indexPathWithIndexes:length:`](/documentation/Foundation/NSIndexPath/indexPathWithIndexes:length:)

Creates an index path with one or more nodes.



---

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)