Initializer

init(_:value:comparator:content:)

Creates a sortable column that generates its label from a string.

Declaration 宣言

init<S, V, C>(_ title: S, value: KeyPath<RowValue, V>, comparator: C, content: @escaping (RowValue) -> Content) where S : StringProtocol, V == C.Compared, C : SortComparator
Available when RowValue conforms to Identifiable, Sort is KeyPathComparator<RowValue>, Content conforms to View, and Label is Text.

Parameters パラメータ

title

A string that describes the column.

value

The path to the property associated with the column, which will be used to update and reflect the sorting state in a table.

comparator

The SortComparator used to order values of the sort value type.

content

The view content to display for each row in a table.

Discussion 議論

This initializer creates a Text view on your behalf, and treats the title similar to init(_:). See Text for more information about localizing strings. このイニシャライザは、Textビューをあなたの代わりに作成します、そしてタイトルをinit(_:)と同じように扱います。Textを文字列のローカライズについてのさらなる情報として見てください。

See Also 参照

Creating a Column with Comparable Values