<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/List/init(_:id:children:rowContent:)-93wbq",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ListVAAs5NeverORszrlE_2id8children10rowContentACyAeA12OutlineGroupVyqd__qd_0_qd_1_qd_1_AA010DisclosureJ0Vyqd_1_AA0I16SubgroupChildrenVGGGqd___s7KeyPathCy7ElementQyd__qd_0_GASyAUqd__SgGqd_1_AUctcAPRs_SkRd__SHRd_0_AA4ViewRd_1_r1_lufc"
  },
  "title" : "init(_:id:children:rowContent:)"
}
-->

# init(_:id:children:rowContent:)

Creates a hierarchical list that identifies its rows based on a key path
to the identifier of the underlying data.

```
nonisolated init<Data, ID, RowContent>(_ data: Data, id: KeyPath<Data.Element, ID>, children: KeyPath<Data.Element, Data?>, @ContentBuilder rowContent: @escaping (Data.Element) -> RowContent) where Content == OutlineGroup<Data, ID, RowContent, RowContent, DisclosureGroup<RowContent, OutlineSubgroupChildren>>, Data : RandomAccessCollection, ID : Hashable, RowContent : View
```

## Parameters

`data`

The data for populating the list.

`id`

The key path to the data model’s identifier.

`children`

A key path to a property whose non-`nil` value gives the
children of `data`. A non-`nil` but empty value denotes a node capable
of having children that is currently childless, such as an empty
directory in a file system. On the other hand, if the property at the
key path is `nil`, then `data` is treated as a leaf node in the tree,
like a regular file in a file system.

`rowContent`

A content builder that creates the view for a single row of
the list.

---

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)