Quick Tip Icon
Quick Tip

Automatically generated List edit operations

Starting from iOS 16 and macOS 13 SwiftUI List view can automatically generate move and delete operations without the need of onMove and onDelete closures.

To create a simple editable list, we can pass a binding to a collection to the List view and provide a set of edit operations we want to allow.

struct ContentView: View {
    @State var items = ["A", "B", "C"]
    var body: some View {
        NavigationView {
                $items, id: \.self,
                edits: [.delete, .move]
            ) { $item in

You can see the available options in the documentation for EditOperations.

If we don't want to allow deletion of certain rows, we can use deleteDisabled() modifier on a per row basis.

Integrating SwiftUI into UIKit Apps by Natalia Panferova book coverIntegrating SwiftUI into UIKit Apps by Natalia Panferova book cover

Check out our book!

Integrating SwiftUI into UIKit Apps

Integrating SwiftUI intoUIKit Apps

A detailed guide on gradually adopting SwiftUI in UIKit projects.

  • Discover various ways to add SwiftUI views to existing UIKit projects
  • Use Xcode previews when designing and building UI
  • Update your UIKit apps with iOS 16 features such as Swift Charts and Lock Screen widgets
  • Migrate larger parts of your apps to SwiftUI while reusing views and controllers built in UIKit