init(_:children:)
Creates an outline group from a collection of root data elements and a key path to element’s children.
Declaration
init<DataElement>(_ data: Data, children: KeyPath<DataElement, Data?>) where ID == DataElement.ID, Parent == TableRow<DataElement>, Leaf == TableRow<DataElement>, Subgroup == TableRow<DataElement>, DataElement : Identifiable, DataElement == Data.ElementParameters
- data:
A collection of tree-structured, identified data.
- children:
A key path to a property whose non-
nilvalue gives the children ofdata. A non-nilbut empty value denotes an element capable of having children that’s currently childless, such as an empty directory in a file system. On the other hand, if the property at the key path isnil, then the outline group treatsdataas a leaf in the tree, like a regular file in a file system.
Discussion
This initializer provides a default TableRowBuilder using TableRow for each data element.
This initializer creates an instance that uniquely identifies table rows across updates based on the identity of the underlying data element.
All generated disclosure groups begin in the collapsed state.