Structure

TableColumn

A column that displays a view for each row in a table.

Declaration 宣言

struct TableColumn<RowValue, Sort, Content, Label> where RowValue : Identifiable, Sort : SortComparator, Content : View, Label : View

Overview 概要

You create a column with a label, content view, and optional key path. The content view builder is called with the value for each row displayed in the table. The column’s key path is to a property of each row value, and is used by sortable tables to reflect the current sort order. The below example creates a sortable column for a table with Person rows, displaying each person’s given name:


TableColumn("Given Name", value: \.givenName) { person in
    Text(person.givenName)
}

For the common case of String properties, you can use the convenience initializer that doesn’t require an explicit content closure and displays that string verbatim.


TableColumn("Given Name", value: \.givenName)

Topics 話題

Creating an Unsortable Column

Creating a Column with Strings

Creating a Column with Integers

Creating a Column with 64-Bit Integers

Creating a Column with 32-Bit Integers

Creating a Column with 16-Bit Integers

Creating a Column with 8-Bit Integers

Creating a Column with Booleans

Creating a Column with Floats

Creating a Column with Doubles

Creating a Column with Dates

Creating a Column with UUIDs

Creating a Column with Comparable Values

Creating a Column with a Comparator

Setting the Column Width

Supporting Types 支援を行う型

Relationships 関係

Conforms To 次に準拠

See Also 参照

Columns