HierarchyViewDataSource

public protocol HierarchyViewDataSource

An object that adopts the HierarchyViewDataSource protocol is responsible for providing the data required by a hierarchy view. It also handles the creation and configuration of cells used by the hierarchy view to display your data.

  • Gets the uuid for root item in hierarchy view. This method is only called when hierarchy view loads first time.

    This synchronous API is used when the environment value hierarchyViewIsAsync is false.

    Declaration

    Swift

    func rootID() -> String

    Return Value

    the uuid for root item in hierarchy view.

  • Gets the number of children for a given item ID

    This synchronous API is used when the environment value hierarchyViewIsAsync is false.

    Declaration

    Swift

    func numberOfChildren(for id: String) -> Int

    Parameters

    id

    The uuid of the item from which hierarchy view requests number of childre

    Return Value

    Number of children the item has.

  • Gets the uuid of a child of the specified parent item at given index.

    This synchronous API is always used by HierarchyView regardless of the hierarchyViewIsAsync environment value.

    Declaration

    Swift

    func childID(idForChildItemAt index: Int, with parentID: String) -> String

    Parameters

    index

    The index of the child item

    parentID

    The uuid of the parent item.

    Return Value

    The uuid of child item.

  • Gets the uuid of the parent item of the specified child item.

    This synchronous API is used when the environment value hierarchyViewIsAsync is false.

    • parameter

      • id: The uuid of the child item whose parent is requested.

    Declaration

    Swift

    func parentID(for id: String) -> String?

    Return Value

    The uuid of the parent item or nil if parent does not exist.

  • Gets the title for the item with specified uuid.

    This synchronous API is used when the environment value hierarchyViewIsAsync is false.

    • parameter

      • uuid: The uuid of the item whose title is requested.

    Declaration

    Swift

    func itemTitle(for id: String) -> String?

    Return Value

    The title of the item or nil if it doesn’t have a title.

  • rootIDAsync() Asynchronous

    Asynchronously returns the UUID of the root item for the hierarchy view.

    This async API is used when the environment value hierarchyViewIsAsync is true.

    Declaration

    Swift

    func rootIDAsync() async throws -> String

    Return Value

    the uuid for root item in hierarchy view.

  • Asynchronously gets the number of children for a given item ID

    This async API is used when the environment value hierarchyViewIsAsync is true.

    Declaration

    Swift

    func numberOfChildrenAsync(for id: String) async throws -> Int

    Parameters

    id

    The uuid of the item from which hierarchy view requests number of childre

    Return Value

    Number of children the item has.

  • parentIDAsync(for:) Asynchronous

    Asynchronously gets the uuid of the parent item of the specified child item.

    This async API is used when the environment value hierarchyViewIsAsync is true.

    • parameter

      • id: The uuid of the child item whose parent is requested.

    Declaration

    Swift

    func parentIDAsync(for id: String) async throws -> String?

    Return Value

    The uuid of the parent item or nil if parent does not exist.

  • itemTitleAsync(for:) Asynchronous

    Asynchronously gets the title for the item with specified uuid.

    This async API is used when the environment value hierarchyViewIsAsync is true.

    • parameter

      • uuid: The uuid of the item whose title is requested.

    Declaration

    Swift

    func itemTitleAsync(for id: String) async throws -> String?

    Return Value

    The title of the item or nil if it doesn’t have a title.