<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 12.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TableColumn/init(_:value:comparator:)-yhkp",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11TableColumnVAA10Foundation17KeyPathComparatorVyxGRs_AA4TextVRs1_rlE_5value10comparatorACyxAg2IGAA015LocalizedStringF0V_s0fG0CyxSSGSSADE08StandardH0VtcAIRs0_rlufc"
  },
  "title" : "init(_:value:comparator:)"
}
-->

# init(_:value:comparator:)

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

```
nonisolated init(_ titleKey: LocalizedStringKey, value: KeyPath<RowValue, String>, comparator: String.StandardComparator = .localizedStandard) where Content == Text
```

## Parameters

`titleKey`

The key for the column’s localized title.

`value`

The path to the property associated with the column,
to display verbatim as text in each row of a table,
and the key path used to create a sort comparator when
sorting the column.

`comparator`

The `SortComparator` used to order the string values.

## Discussion

This initializer creates a `Text` view for you, and treats the
localized key similar to `Text/init(_:tableName:bundle:comment:)`.
For more information about localizing strings, see `Text`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)