<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/List/init(_:id:editActions:rowContent:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ListVAAs5NeverORszrlE_2id11editActions10rowContentACyAeA7ForEachVyAA27IndexedIdentifierCollectionVyqd__qd_0_Gqd_0_AA08EditablenI0Vyqd_1_qd__GGGAA7BindingVyqd__G_s7KeyPathCy7ElementSTQyd__qd_0_GAA04EditG0Vyqd__Gqd_1_ATyAYGctcAQRs_SMRd__SkRd__SHRd_0_AA4ViewRd_1_SH5IndexSlRpd__r1_lufc"
  },
  "title" : "init(_:id:editActions:rowContent:)"
}
-->

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

Creates a list that computes its rows on demand from an underlying
collection of identifiable data and enables editing the collection.

```
nonisolated init<Data, ID, RowContent>(_ data: Binding<Data>, id: KeyPath<Data.Element, ID>, editActions: EditActions<Data>, @ContentBuilder rowContent: @escaping (Binding<Data.Element>) -> RowContent) where Content == ForEach<IndexedIdentifierCollection<Data, ID>, ID, EditableCollectionContent<RowContent, Data>>, Data : MutableCollection, Data : RandomAccessCollection, ID : Hashable, RowContent : View, Data.Index : Hashable
```

## Parameters

`data`

A collection of identifiable data for computing the list.

`id`

The key path to the data model’s identifier.

`editActions`

The edit actions that are synthesized on `data`.

`rowContent`

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

## Discussion

The following example creates a list to display a collection of favorite
foods allowing the user to delete or move elements from the
collection.

```
List($foods, editActions: [.delete, .move]) { $food in
   HStack {
       Text(food.name)
       Toggle("Favorite", isOn: $food.isFavorite)
   }
}
```

Use [`deleteDisabled(_:)`](/documentation/SwiftUI/View/deleteDisabled(_:)) and [`moveDisabled(_:)`](/documentation/SwiftUI/View/moveDisabled(_:))
to disable respectively delete or move actions on a per-row basis.

Explicit [`onDelete(perform:)`](/documentation/SwiftUI/DynamicViewContent/onDelete(perform:)),
[`onMove(perform:)`](/documentation/SwiftUI/DynamicViewContent/onMove(perform:)), or
[`swipeActions(edge:allowsFullSwipe:content:)`](/documentation/SwiftUI/View/swipeActions(edge:allowsFullSwipe:content:))
modifiers override any synthesized action.

---

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)