TreeProperty
open class TreeProperty<Node> : AsyncReadablePropertyType where Node : TreeNode
Undocumented
-
Declaration
Swift
public typealias Value = Node -
Declaration
Swift
public typealias SignalChange = [TreeChange<Node>] -
Undocumented
Declaration
Swift
public internal(set) var root: Node -
Declaration
Swift
public var value: Node? { get } -
Declaration
Swift
public let signal: Signal<SignalChange> -
Declaration
Swift
public var property: AsyncReadableProperty<Node> { get } -
Returns the node with the given identifier.
Declaration
Swift
public func nodeForID(_ id: Node.ID) -> Node? -
Returns the node at the given path.
Declaration
Swift
public func nodeAtPath(_ path: TreePath<Node>) -> Node? -
Returns the parent of the given node.
Declaration
Swift
public func parentForID(_ id: Node.ID) -> Node? -
Returns the parent of the given node.
Declaration
Swift
public func parentForNode(_ node: Node) -> Node? -
Returns the index of the given node relative to its parent.
Declaration
Swift
public func indexForID(_ id: Node.ID) -> Int? -
Returns the index of the given node relative to its parent.
Declaration
Swift
public func indexForNode(_ node: Node) -> Int? -
Returns the tree path of the given node.
Declaration
Swift
public func pathForNode(_ node: Node) -> TreePath<Node>? -
Returns true if the first node is a descendent of (or the same as) the second node.
Declaration
Swift
public func isNodeDescendent(_ node: Node, ofAncestor ancestor: Node) -> Bool -
Returns an order value that would be appropriate for a node to be appended as a child of the given parent. Note: This only works when there is a distinct
order
property for each element of type Double.Declaration
Swift
public func orderForAppend(inParent parent: Node.ID?) -> Double -
Returns an order value that would be appropriate for a node to be inserted as the next sibling after the given node. Note: This only works when there is a distinct
order
property for each element of type Double.Declaration
Swift
public func orderForInsert(after previous: Node.ID) -> (parentID: Node.ID?, order: Double) -
Returns an order value that would be appropriate for a node to be moved from its current position to the new destination position. Note: This only works when there is a distinct
order
property for each element of type Double. Note: dstPath.index is relative to the state of the array after the item is removed. -
Returns a view on this TreeProperty that delivers the full tree through its Signal whenever there is any change in the underlying TreeProperty.
Declaration
Swift
public func fullTree() -> AsyncReadableProperty<Node>
TreeProperty Class Reference