Contents

init(_:id:rowContent:)

Creates a list that identifies its rows based on a key path to the identifier of the underlying data.

Declaration

@MainActor @preconcurrency init<Data, ID, RowContent>(_ data: Binding<Data>, id: KeyPath<Data.Element, ID>, @ViewBuilder rowContent: @escaping (Binding<Data.Element>) -> RowContent) where Content == ForEach<LazyMapSequence<Data.Indices, (Data.Index, ID)>, ID, RowContent>, Data : MutableCollection, Data : RandomAccessCollection, ID : Hashable, RowContent : View, Data.Index : Hashable

Parameters

  • data:

    The data for populating the list.

  • id:

    The key path to the data model’s identifier.

  • rowContent:

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

See Also

Creating a list from enumerated data