HierarchyItemView

public struct HierarchyItemView
extension HierarchyItemView: View
extension HierarchyItemView: _ViewEmptyChecking

A HierarchyItemView representing a component for displaying a collection item’s business object content and hierarchy information in a user interface.

Overview

It serves as the default item view for presenting hierarchy items within a HierarchyItemView. It includes various components such as titles, subtitles, footnotes, icons, detail images, statuses, and accessory views that together provide a comprehensive representation of the data associated with the hierarchy item. The HierarchyItemView can be utilized within a HierarchyView to display hierarchical information. Alternatively, it can also be used independently to present an item without the context of a hierarchical structure.

Key Features

  • Composable content slots: title, subtitle, footnote, icons, detail image, status, accessory view.
  • Optional hierarchyIndicator slot for navigation or contextual counts.
  • Integrates with HierarchyView for navigation and selection.
  • Supports standard accessory styles (e.g. disclosure).

Usage Independent:

To use HierarchyItemView independently and without HierarchyView.

List {
    ForEach(0..<5) { index in
        HierarchyItemView(
            title: { Text("Title \(index)") },
            subtitle: { Text("Subtitle \(index)") },
            footnote: { Text("Footnote \(index)") },
            icons: {
                FioriIcon.message.badge.foregroundStyle(Color.preferredColor(.tintColor))
                FioriIcon.actions.bookmark.foregroundStyle(Color.preferredColor(.tintColor))
                FioriIcon.actions.attachment.foregroundStyle(Color.preferredColor(.tintColor))
            },
            detailImage: { FioriIcon.message.messageInformation.resizable().foregroundStyle(Color.preferredColor(.tintColor)) },
            status: { Image(systemName: "exclamationmark.square.fill").foregroundStyle(Color.preferredColor(.negativeLabel)) },
            accessoryType: .disclosure,
            hierarchyIndicator: {
                HierarchyIndicator(
                    title: index == 4 ? { EmptyView()} : { Text(self.formatNumber(indicatorNumber[index])) },
                    isMultiline: false,
                    isSelected: false,
                    isClickable: false
                )
            })
   }
}

See Also

HierarchyView, HierarchyIndicator.