Contents

init(_:children:selection:rowContent:)

Creates a hierarchical list that computes its rows on demand from a binding to an underlying collection of identifiable data and allowing users to have exactly one row always selected.

Declaration

@MainActor @preconcurrency init<Data, RowContent>(_ data: Binding<Data>, children: WritableKeyPath<Data.Element, Data?>, selection: Binding<SelectionValue>, @ViewBuilder rowContent: @escaping (Binding<Data.Element>) -> RowContent) where Content == OutlineGroup<Binding<Data>, Data.Element.ID, RowContent, RowContent, DisclosureGroup<RowContent, OutlineSubgroupChildren>>, Data : MutableCollection, Data : RandomAccessCollection, RowContent : View, Data.Element : Identifiable

Parameters

  • data:

    The identifiable data for computing the list.

  • children:

    A key path to a property whose non-nil value gives the children of data. A non-nil but empty value denotes a node capable of having children that is currently childless, such as an empty directory in a file system. On the other hand, if the property at the key path is nil, then data is treated as a leaf node in the tree, like a regular file in a file system.

  • selection:

    A binding to a non optional selected value.

  • rowContent:

    A view builder that creates the view for a single row of the list.

See Also

Creating a list from hierarchical data