---
title: "init(_:id:rowContent:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/list/init(_:id:rowcontent:)-4s0aj"
---

# init(_:id:rowContent:)

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

## Declaration

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

## Parameters

- `data`: The data for populating the list.
- `id`: The key path to the data model’s identifier.
- `rowContent`: A content builder that creates the view for a single row of the list.
