Structure
IndexPath
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
A list of indexes that together represent the path to a specific location in a tree of nested arrays.
struct IndexPath
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.
Topics
Operators
static func + (IndexPath, IndexPath) -> IndexPathCombines the elements of two index paths into a single index path.static func += (inout IndexPath, IndexPath)Appends the elements of another index path to this index path.static func == (IndexPath, IndexPath) -> Boolstatic func < (IndexPath, IndexPath) -> Boolstatic func > (IndexPath, IndexPath) -> Boolstatic func <= (IndexPath, IndexPath) -> Boolstatic func >= (IndexPath, IndexPath) -> Bool
Initializers
init()Creates an empty index path.init(arrayLiteral: IndexPath.Element...)Creates an index path from an array literal.init(index: IndexPath.Element)Creates an index path with a single element.init(indexes:)Creates an index path from an array of elements.
Instance Properties
var count: Intvar endIndex: IndexPath.IndexOne past the index of the last node in the index path.var startIndex: IndexPath.IndexThe index of the first node in the index path.
Instance Methods
func append(_:)Appends an array of elements to this index path as additional nodes.func appending(_:)Returns a new index path containing the elements of this one plus an array of additional elements.func compare(IndexPath) -> ComparisonResultCompares this index path to another in depth-first traversal order.func dropLast() -> IndexPathReturns a new index path containing all but the last element.func hash(into: inout Hasher)func index(after: IndexPath.Index) -> IndexPath.IndexReturns the index that follows the given index.func index(before: IndexPath.Index) -> IndexPath.IndexReturns the index that precedes the given index.func makeIterator() -> IndexingIterator<IndexPath>Returns an iterator over the nodes of the index path.
Subscripts
subscript(_:)Accesses one of the index path’s nodes.
Type Aliases
typealias ElementA type that represents one node of an index path.typealias IndexA type that points to a particular node in an index path, similar to an array index.typealias IndicesA type that represents a group of nodes in an index path.
Default Implementations
Relationships
Conforms To
Foundation.ReferenceConvertibleSwift.BidirectionalCollectionSwift.CollectionSwift.ComparableSwift.CopyableSwift.CustomDebugStringConvertibleSwift.CustomReflectableSwift.CustomStringConvertibleSwift.DecodableSwift.EncodableSwift.EquatableSwift.EscapableSwift.ExpressibleByArrayLiteralSwift.HashableSwift.MutableCollectionSwift.RandomAccessCollectionSwift.SendableSwift.SendableMetatypeSwift.Sequence