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
hierarchyViewIsAsyncis false.Declaration
Swift
func rootID() -> StringReturn 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
hierarchyViewIsAsyncis false.Declaration
Swift
func numberOfChildren(for id: String) -> IntParameters
idThe 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
hierarchyViewIsAsyncenvironment value.Declaration
Swift
func childID(idForChildItemAt index: Int, with parentID: String) -> StringParameters
indexThe index of the child item
parentIDThe 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
hierarchyViewIsAsyncis 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
nilif parent does not exist. -
Gets the title for the item with specified uuid.
This synchronous API is used when the environment value
hierarchyViewIsAsyncis 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
nilif it doesn’t have a title. -
rootIDAsync()AsynchronousAsynchronously returns the UUID of the root item for the hierarchy view.
This async API is used when the environment value
hierarchyViewIsAsyncis true.Declaration
Swift
func rootIDAsync() async throws -> StringReturn Value
the uuid for root item in hierarchy view.
-
numberOfChildrenAsync(for:Asynchronous) Asynchronously gets the number of children for a given item ID
This async API is used when the environment value
hierarchyViewIsAsyncis true.Declaration
Swift
func numberOfChildrenAsync(for id: String) async throws -> IntParameters
idThe 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
hierarchyViewIsAsyncis 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
nilif 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
hierarchyViewIsAsyncis 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
nilif it doesn’t have a title.