<!--
{
  "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/ForEach/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7ForEachVA2A15TableRowContentR0_rlEyACyxq_AA0eF0Vy7ElementQzGGxcAG_2IDQZRs_AIRs0_s12IdentifiableAHRQrlufc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates an instance that uniquely identifies and creates table rows
across updates based on the identity of the underlying data.

```
@export(implementation) nonisolated init(_ data: Data) where ID == Data.Element.ID, Content == TableRow<Data.Element>, Data.Element : Identifiable
```

## Parameters

`data`

The identified data that the [`ForEach`](/documentation/SwiftUI/ForEach) instance uses
to create table rows dynamically.

## Discussion

The following example creates a `Person` type that conforms to
<doc://com.apple.documentation/documentation/Swift/Identifiable>, and an
array of this type called `people`. A `ForEach` instance iterates over
the array, producing new [`TableRow`](/documentation/SwiftUI/TableRow) instances implicitly.

```
private struct Person: Identifiable {
    var id = UUID()
    var name: String
}

@State private var people: [Person] = /* ... */

Table(of: Person.self) {
    TableColumn("ID", value: \.id.uuidString)
    TableColumn("Name", value: \.name)
} rows: {
    Section("Team") {
        /* This is equivalent to the line below:
        ForEach(people) { TableRow($0) }
        */
        ForEach(people)
    }
}
```

---

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)