<!--
{
  "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/removingLastIndex()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSIndexPath(im)indexPathByRemovingLastIndex"
  },
  "title" : "removingLastIndex()"
}
-->

# removingLastIndex()

Returns an index path with the nodes in the receiving index path, excluding the last one.

```
func removingLastIndex() -> IndexPath
```

## Return Value

A new index path with the receiving index path’s indexes, excluding the last one.

## Discussion

Returns an empty `NSIndexPath` instance if the receiving index path’s length is 1 or less.

### Special Considerations

In OS X v10.4 this method returns `nil` when the length of the receiving index path is 1 or less. On iOS and macOS 10.5 and later this method never returns `nil`.

---

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)