Class

NSIndexPath

The NSIndexPath class represents the path to a specific node in a tree of nested array collections. This path is known as an index path.

Overview

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.

Figure 1

Index path 1.4.3.2

Index path “1.4.3.2”

Symbols

Creating Index Paths

init(row: Int, section: Int)

Returns an index-path object initialized with the indexes of a specific row and section in a table view.

init(item: Int, section: Int)

Returns an index-path object initialized with the indexes of a specific item and section in a collection view.

init(index: Int)

Initializes an allocated NSIndexPath object with a one-node index path.

init(indexes: UnsafePointer<Int>!, length: Int)

Initializes an allocated NSIndexPath object with an index path of a specific length.

Querying Index Paths

func index(atPosition: Int)

Provides the index at a particular node in the index path.

func adding(Int)

Provides an index path containing the indexes in the receiving index path and another index.

func removingLastIndex()

Provides an index path with the indexes in the receiving index path, excluding the last one.

var length: Int

The number of indexes in the index path.

func getIndexes(UnsafeMutablePointer<Int>, range: NSRange)

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

func getIndexes(UnsafeMutablePointer<Int>)

Copies the objects contained in the index path into indexes.

var section: Int

An index number identifying a section in a table view or collection view.

var row: Int

An index number identifying a row in a section of a table view.

var item: Int

An index number identifying an item in a section of a collection view.

Comparing Index Paths

func compare(IndexPath)

Indicates the depth-first traversal order of the receiving index path and another index path.

Relationships

Inherits From