Initializer

init(_:value:comparator:)

Creates a sortable column that displays a string property, and which generates its label from a localized string key.

Declaration 宣言

init(_ titleKey: LocalizedStringKey, value: KeyPath<RowValue, String>, comparator: String.StandardComparator = .localizedStandard) where Content == Text
Available when RowValue conforms to Identifiable, Sort is KeyPathComparator<RowValue>, Content conforms to View, and Label is Text.

Parameters パラメータ

titleKey

The key for the column’s localized title.

value

The path to the property associated with the column, which will be used to display as verbatim text in each row of a table and the keypath used to create a sort comparator when the column is sorted.

comparator

The SortComparator used to order the string values.

Discussion 議論

This initializer creates a Text view on your behalf, and treats the localized key similar to init(_:tableName:bundle:comment:). See Text for more information about localizing strings. このイニシャライザは、Textビューをあなたに代わって作成します、そしてローカライズされたキーをinit(_:tableName:bundle:comment:)に似たものと見なします。Textを文字列のローカライズについてのさらなる情報として見てください。

See Also 参照

Creating a Column with Strings