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.

  • Undocumented

    Declaration

    Swift

    public init(@ViewBuilder title: () -> any View,
                @ViewBuilder subtitle: () -> any View = { EmptyView() },
                @ViewBuilder footnote: () -> any View = { EmptyView() },
                @IconBuilder icons: () -> any View = { EmptyView() },
                @ViewBuilder detailImage: () -> any View = { EmptyView() },
                @ViewBuilder status: () -> any View = { EmptyView() },
                accessoryType: AccessoryType = .none,
                @ViewBuilder hierarchyIndicator: () -> any View = { EmptyView() },
                componentIdentifier: String? = HierarchyItemView.identifier)
  • Attaches a long‑press copy action to the HierarchyItemView that copies the given item details to the system pasteboard. Use this modifier on a HierarchyItemView to enable a long‑press gesture which, when recognized, places a textual representation of the supplied details (title, optional subtitle, and optional footnote) on the system pasteboard.

    Declaration

    Swift

    func copyDetailsOnLongPress(title: String, subtitle: String?, footnote: String?) -> some View

    Return Value

    A view that performs the copy action on long press.

  • Undocumented

    Declaration

    Swift

    static let identifier: String
  • Undocumented

    Declaration

    Swift

    init(title: AttributedString,
         subtitle: AttributedString? = nil,
         footnote: AttributedString? = nil,
         icons: [TextOrIcon] = [],
         detailImage: Image? = nil,
         status: TextOrIcon? = nil,
         accessoryType: AccessoryType = .none,
         @ViewBuilder hierarchyIndicator: () -> any View = { EmptyView() })
  • Undocumented

    Declaration

    Swift

    init(_ configuration: HierarchyItemViewConfiguration)
  • Declaration

    Swift

    @MainActor
    public var body: some View { get }
  • Undocumented

    Declaration

    Swift

    public var isEmpty: Bool { get }