FUIHierarchyViewDataSource
public protocol FUIHierarchyViewDataSource : AnyObject
An object that adopts the UICollectionViewDataSource 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.
-
Return the uuid for root item in hierarchy view. This method is only called when hierarchy view loads first time and whenever
reloadData()
is called.Declaration
Swift
func rootUUID(in hierarchyView: FUIHierarchyView) -> String?
Parameters
hierarchyView
The hierarchy view that requests this information.
-
Return the number of children of an item.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, numberOfChildrenForItemWith uuid: String) -> Int
Parameters
hierarchyView
The hierarchy view that requests this information.
uuid
The uuid of the item from which hierarchy view requests number of children.
Return Value
Number of children the item has.
-
Return the uuid of a child of the specified parent item at given index.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, uuidForChildItemAt index: Int, with parent: String) -> String
Parameters
hierarchyView
The hierarchy view that requests this information.
index
The index of the child item.
parentUUID
The uuid of the parent item.
Return Value
The uuid of child item.
-
Return the uuid of the parent item of the specified child item.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, parentForItemWith uuid: String) -> String?
Parameters
hierarchyView
The hierarchy view that requests this information.
uuid
The uuid of the child item whose parent is requested.
Return Value
The uuid of the parent item or
nil
if parent does not exist. -
Instruct your data source object to begin prefetch data for items with uuids.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, prefetchDataForItemsWith uuids: [String])
Parameters
hierarchyView
The hierarchy view that requests this information.
uuids
An array of uuids specifying those items for which the data is to be fetched.
-
Return a reusable collection item cell for the item with specified uuid.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, cellForItemWith uuid: String) -> FUIHierarchyCollectionItem
Parameters
hierarchyView
The hierarchy view that requests this information.
uuid
The uuid of the item.
Return Value
A configured collection item cell object.
-
Return the title for the item with specified uuid.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, titleForItemWith uuid: String) -> String?
Parameters
hierarchyView
The hierarchy view that requests this information.
uuid
The uuid of the item whose title is requested.
Return Value
The title of the item or
nil
if it doesn’t have a title.