Initializer

init(_:selection:rowContent:)

Creates a list that computes its views on demand over a constant range, optionally allowing users to select multiple rows.

Declaration 宣言

init<RowContent>(_ data: Range<Int>, selection: Binding<Set<SelectionValue>>?, rowContent: @escaping (Int) -> RowContent) where Content == ForEach<Range<Int>, Int, HStack<RowContent>>, RowContent : View
Available when SelectionValue conforms to Hashable and Content conforms to View.

Parameters パラメータ

data

A constant range of data to populate the list.

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. あるビュービルダー、それはリストの単一の行に対するビューを作成します。

Discussion 議論

This instance only reads the initial value of data and doesn’t need to identify views across updates. To compute views on demand over a dynamic range, use init(_:id:selection:rowContent:).

See Also 参照

Creating a List from a Range