---
title: NSIndexPath
framework: foundation
role: symbol
role_heading: Class
path: foundation/nsindexpath
---

# NSIndexPath

A list of indexes that together represent the path to a specific location in a tree of nested arrays.

## Declaration

```swift
class NSIndexPath
```

## Overview

Overview In Swift, this object bridges to IndexPath; use NSIndexPath when you need reference semantics or other Foundation-specific behavior. Each index in an index path represents the index into an array of children from one node in the tree to another, deeper, node. For example, the index path 1.4.3.2 specifies the path shown in Figure 1.

note: The UIKit framework adds programming interfaces to the NSIndexPath class of the Foundation framework to facilitate the identification of rows and sections in UITableView objects and the identification of items and sections in UICollectionView objects. The API consists of class factory methods and properties for accessing the various indexed values. You use the factory methods to create an index path for the corresponding table view or collection view. important: The Swift overlay to the Foundation framework provides the IndexPath structure, which bridges to the NSIndexPath class. For more information about value types, see Working with Foundation Types.

## Topics

### Creating and Initializing Index Paths

- [init(index:)](foundation/nsindexpath/init(index:).md)
- [init(indexes:length:)](foundation/nsindexpath/init(indexes:length:).md)

### Using Special Node Names

- [init(forRow:inSection:)](foundation/nsindexpath/init(forrow:insection:).md)
- [init(forItem:inSection:)](foundation/nsindexpath/init(foritem:insection:).md)
- [section](foundation/nsindexpath/section.md)
- [row](foundation/nsindexpath/row.md)
- [item](foundation/nsindexpath/item.md)

### Counting Nodes

- [length](foundation/nsindexpath/length.md)

### Adding and Removing Nodes

- [adding(_:)](foundation/nsindexpath/adding(_:).md)
- [removingLastIndex()](foundation/nsindexpath/removinglastindex().md)

### Comparing Index Paths

- [compare(_:)](foundation/nsindexpath/compare(_:).md)

### Working with Indexes

- [index(atPosition:)](foundation/nsindexpath/index(atposition:).md)
- [getIndexes(_:range:)](foundation/nsindexpath/getindexes(_:range:).md)
- [getIndexes(_:)](foundation/nsindexpath/getindexes(_:).md)

### Initializers

- [init(coder:)](foundation/nsindexpath/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
