HierarchyIndex
public struct HierarchyIndex : Hashable, Comparable
Specifies the hierarchical index for a sub-tree.
-
The hierarchical reference for the root item of a tree.
Declaration
Swift
public static let root: HierarchyIndex -
The list of indices that represent the hierarchical relationships for this hierarchy index. Is an empty list for items at the root of the tree view.
Declaration
Swift
public var indices: [Int] -
Undocumented
Declaration
Swift
public subscript(index: Int) -> ItemIndex { get } -
The hierarchy index for the parent of this index.
If this hierarchy index is the root hierarchy,
nilis returned.Declaration
Swift
public var parent: HierarchyIndex? { get } -
Returns
trueif this hierarchy index points to the root of the tree.Convenience for
indices.isEmpty.Declaration
Swift
public var isRoot: Bool { get } -
Returns the depth of this hierarchy index.
Declaration
Swift
public var depth: Int { get } -
Undocumented
Declaration
Swift
public init(indices: [Int]) -
Creates an item index with a given index with this hierarchy index as a parent.
Declaration
Swift
public func subItem(index: Int) -> ItemIndex -
Returns
trueif this hierarchy is contained within another hierarchy.Returns
trueforself.isSubHierarchy(of: self).Declaration
Swift
public func isSubHierarchy(of other: HierarchyIndex) -> Bool -
Returns
trueiflhscomes before in a hierarchy compared torhs.A hierarchy item comes before another if any index in
indicescompares lower to another hierarchy item.In case the indices have different depths,
trueis returned ifrhsis of a deeper hierarchy (lhs.indices.count < rhs.indices.count).Declaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool