<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/List/init(_:editActions:selection:rowContent:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ListV_11editActions9selection10rowContentACyxAA7ForEachVyAA27IndexedIdentifierCollectionVyqd__7ElementST_2IDQYd__GAmA08EditablemH0Vyqd_0_qd__GGGAA7BindingVyqd__G_AA04EditE0Vyqd__GAUyxGqd_0_AUyAKSTQyd__GctcARRs_SMRd__SkRd__AA4ViewRd_0_s12IdentifiableA_RQSH5IndexSlRpd__r0_lufc::OverloadGroup"
  },
  "title" : "init(_:editActions:selection:rowContent:)"
}
-->

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

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

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

## Parameters

`data`

The identifiable data for computing the list.

`editActions`

The edit actions that are synthesized on `data`.

`selection`

A binding to a non optional selected value.

`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, and select a single element.

```
List(
    $foods,
    editActions: [.delete, .move],
    selection: $selectedFood
) { $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)