Initializer

init(_:id:children:selection:rowContent:)

Creates a hierarchical list that identifies its rows based on a key path to the identifier of the underlying data, optionally allowing users to select multiple rows.

Declaration 宣言

init<Data, ID, RowContent>(_ data: Binding<Data>, id: KeyPath<Data.Element, ID>, children: WritableKeyPath<Data.Element, Data?>, selection: Binding<Set<SelectionValue>>?, rowContent: @escaping (Binding<Data.Element>) -> RowContent) where Content == OutlineGroup<Binding<Data>, ID, RowContent, RowContent, DisclosureGroup<RowContent, OutlineSubgroupChildren>>, Data : MutableCollection, Data : RandomAccessCollection, ID : Hashable, RowContent : View
Available when SelectionValue conforms to Hashable and Content conforms to View.

Parameters パラメータ

data

The data for populating the list. リストに満たすためのデータ。

id

The key path to the data model’s identifier. データモデルのもつ識別子へのキーパス。

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 set that identifies selected rows. ある集合へのバインディング、それは選択された行を識別します。

rowContent

A view builder that creates the view for a single row of the list. あるビュービルダー、それはリストの単一の行に対するビューを作成します。

See Also 参照

Listing Bound, Hierarchical Data