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,
nil
is returned.Declaration
Swift
public var parent: HierarchyIndex? { get }
-
Returns
true
if 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
true
if this hierarchy is contained within another hierarchy.Returns
true
forself.isSubHierarchy(of: self)
.Declaration
Swift
public func isSubHierarchy(of other: HierarchyIndex) -> Bool
-
Returns
true
iflhs
comes before in a hierarchy compared torhs
.A hierarchy item comes before another if any index in
indices
compares lower to another hierarchy item.In case the indices have different depths,
true
is returned ifrhs
is of a deeper hierarchy (lhs.indices.count < rhs.indices.count
).Declaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool