---
title: "init(_:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/foreach/init(_:)"
---

# init(_:)

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

## Declaration

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

## Parameters

- `data`: The identified data that the doc://com.apple.SwiftUI/documentation/SwiftUI/ForEach instance uses to create table rows dynamically.

## Discussion

Discussion The following example creates a Person type that conforms to Identifiable, and an array of this type called people. A ForEach instance iterates over the array, producing new 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)     } }

## See Also

### Creating a collection

- [init(_:content:)](swiftui/foreach/init(_:content:).md)
- [init(_:id:content:)](swiftui/foreach/init(_:id:content:).md)
- [init(sections:content:)](swiftui/foreach/init(sections:content:).md)
- [init(subviews:content:)](swiftui/foreach/init(subviews:content:).md)
