Generic Structure

List

A container that presents rows of data arranged in a single column.

Declaration

struct List<SelectionValue, Content> where SelectionValue : Hashable, Content : View

Topics

Creating a List

init(content: () -> Content)

Creates a list with the given content.

init<Data, ID, RowContent>(Data, id: KeyPath<Data.Element, ID>, rowContent: (Data.Element) -> RowContent)

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

init<Data, ID, RowContent>(Data, id: KeyPath<Data.Element, ID>, selection: Binding<Set<SelectionValue>>?, rowContent: (Data.Element) -> RowContent)

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

init<Data, ID, RowContent>(Data, id: KeyPath<Data.Element, ID>, selection: Binding<SelectionValue?>?, rowContent: (Data.Element) -> RowContent)

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

init<RowContent>(Range<Int>, rowContent: (Int) -> RowContent)

Creates a list that computes its views on demand over a constant range.

init<Data, RowContent>(Data, rowContent: (Data.Element) -> RowContent)

Creates a list that computes its rows on demand from an underlying collection of identifiable data.

init<RowContent>(Range<Int>, selection: Binding<Set<SelectionValue>>?, rowContent: (Int) -> RowContent)

Creates a list that computes its views on demand over a constant range.

init<RowContent>(Range<Int>, selection: Binding<SelectionValue?>?, rowContent: (Int) -> RowContent)

Creates a list that computes its views on demand over a constant range.

init<Data, RowContent>(Data, selection: Binding<Set<SelectionValue>>?, rowContent: (Data.Element) -> RowContent)

Creates a list that computes its rows on demand from an underlying collection of identifiable data.

init<Data, RowContent>(Data, selection: Binding<SelectionValue?>?, rowContent: (Data.Element) -> RowContent)

Creates a list that computes its rows on demand from an underlying collection of identifiable data.

init(selection: Binding<Set<SelectionValue>>?, content: () -> Content)

Creates a list with the given content that supports selecting multiple rows.

init(selection: Binding<SelectionValue?>?, content: () -> Content)

Creates a list with the given content that supports selecting a single row.

Applying Standard Modifiers

View Modifiers

Configure this view and the views it contains by applying standard modifiers.

Relationships

Conforms To

See Also

Lists and Scroll Views

struct ForEach

The collection of underlying identified data that SwiftUI uses to create views dynamically.

struct ScrollView

A scrollable view.

protocol DynamicViewContent

A type of view that generates views from an underlying collection of data.

protocol Identifiable

A class of types whose instances hold the value of an entity with stable identity.

enum Axis

The horizontal or vertical dimension in a 2D coordinate system.