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

# init(_: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, RowContent>(_ data: Binding<Data>, editActions: EditActions<Data>, @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`

A collection of identifiable data for computing the list.

`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 `DynamicViewContent.onDelete(perform:)`,
`DynamicViewContent.onMove(perform:)`, or
`View.swipeActions(edge:allowsFullSwipe:content:)`
modifiers will 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)