<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Table/init(_:children:sortOrder:columnCustomization:columns:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5TableV_8children9sortOrder19columnCustomization7columnsACyxAA0C19OutlineGroupContentVyqd__Gq0_Gqd___s7KeyPathCyxqd__SgGAA7BindingVySayqd_0_GGAQyAA0c6ColumnH0VyxGGSgq0_yXEtcAJRs_SkRd__10Foundation14SortComparatorRd_0_7ElementQyd__0C8RowValueRt0_8ComparedQyd_0_A0_RSr0_lufc"
  },
  "title" : "init(_:children:sortOrder:columnCustomization:columns:)"
}
-->

# init(_:children:sortOrder:columnCustomization:columns:)

Creates a sortable, hierarchical table that computes its rows based on a
collection of identifiable data and key path to the children of that
data.

```
nonisolated init<Data, Sort>(_ data: Data, children: KeyPath<Data.Element, Data?>, sortOrder: Binding<[Sort]>, columnCustomization: Binding<TableColumnCustomization<Value>>? = nil, @TableColumnBuilder<Value, Sort> columns: () -> Columns) where Rows == TableOutlineGroupContent<Data>, Data : RandomAccessCollection, Sort : SortComparator, Columns.TableRowValue == Data.Element, Data.Element == Sort.Compared
```

## Parameters

`data`

The identifiable data for computing the table rows.

`children`

A key path to a property whose non-`nil` value gives the
children of `data`, and whose `nil` value represents a leaf row of
the hierarchy, which is not capable of having children.

`sortOrder`

A binding to the ordered sorting of columns.

`columnCustomization`

A binding to the state of columns.

`columns`

The columns to display in the table.

## Discussion

Each column in the table that should participate in customization is
required to have an identifier, specified with
[`customizationID(_:)`](/documentation/SwiftUI/TableColumnContent/customizationID(_:)).

---

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)