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
hierarchyViewThe hierarchy view that requests this information.
-
Return the number of children of an item.
Declaration
Swift
func hierarchyView(_ hierarchyView: FUIHierarchyView, numberOfChildrenForItemWith uuid: String) -> IntParameters
hierarchyViewThe hierarchy view that requests this information.
uuidThe 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) -> StringParameters
hierarchyViewThe hierarchy view that requests this information.
indexThe index of the child item.
parentUUIDThe 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
hierarchyViewThe hierarchy view that requests this information.
uuidThe uuid of the child item whose parent is requested.
Return Value
The uuid of the parent item or
nilif 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
hierarchyViewThe hierarchy view that requests this information.
uuidsAn 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) -> FUIHierarchyCollectionItemParameters
hierarchyViewThe hierarchy view that requests this information.
uuidThe 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
hierarchyViewThe hierarchy view that requests this information.
uuidThe uuid of the item whose title is requested.
Return Value
The title of the item or
nilif it doesn’t have a title.