HierarchyIndicator
public struct HierarchyIndicator
extension HierarchyIndicator: View
extension HierarchyIndicator: _ViewEmptyChecking
HierarchyIndicator is a stack view including an icon and the specific title text. It is intended to be used with HierarchItemView.
Overview
Use HierarchyIndicator to convey an item’s relationship or navigability within a hierarchy. It is typically embedded in a HierarchyItemView and, when used inside a HierarchyView, can facilitate forward navigation by returning a child item ID from its onClick action. The indicator can also be used standalone to represent contextual information outside of a hierarchy.
Usage
The indicator is typically used with HierarchyItemView within a HierarchyViewto provide context about the item’s status within the hierarchy. It can also be employed
independently to represent information outside of a structured view. Consumers of this component should initialize the indicator based on their specific use cases,
ensuring that it accurately represents the appropriate data and state depending on whether it is used in conjunction with HierarchyItemView and HierarchyView, or as a standalone component.
Within a HierarchyView, consumers should provide the onClick event handler that returns the item’s UUID. This ensures that the data can be navigated correctly when the next button in the HierarchyHeader is clicked.
@State var activeChildItem: String?
HierarchyView(
dataSource: dataSource,
hierarchyItem: { id in
hierarchyIndicator: {
let childrenCount = dataSource.numberOfChildren(for: id)
HierarchyIndicator(
title: AttributedString(String("\(id)")),
isMultiline: self.isMultiline,
isSelected: activeChildItem == id,
isClickable: childrenCount > 0
){
id
}
},
activeChildItem: self.$activeChildItem
)
See Also
HierarchyView, HierarchyItemView.
-
Undocumented
Declaration
Swift
public init(@ViewBuilder title: () -> any View, @ViewBuilder icon: () -> any View = { EmptyView() }, isMultiline: Bool = true, isSelected: Bool = false, isClickable: Bool = true, onClick: (() -> String?)? = nil, componentIdentifier: String? = HierarchyIndicator.identifier) -
Undocumented
Declaration
Swift
static let identifier: String -
Undocumented
Declaration
Swift
init(title: AttributedString, icon: Image? = nil, isMultiline: Bool = true, isSelected: Bool = false, isClickable: Bool = true, onClick: (() -> String?)? = nil) -
Undocumented
Declaration
Swift
init(_ configuration: HierarchyIndicatorConfiguration) -
Declaration
Swift
@MainActor public var body: some View { get } -
Undocumented
Declaration
Swift
public var isEmpty: Bool { get }