79338083

Date: 2025-01-08 05:59:18
Score: 1
Natty:
Report link

Hi the list has its own editActions like .delete

also I tried with this code and the delete swipe action is inside of the list.

struct ContentView: View {
@State private var users = ["Glenn", "Malcolm", "Nicola", "Terri"]

    var body: some View {
        NavigationStack {
            List($users, id: \.self) { $user in
                Text(user)
                    .containerShape(RoundedRectangle(cornerRadius: 10))
                    .swipeActions {
                        Button(role: .destructive) {
                            users.removeFirst()
                        } label: {
                            Label("Delete", systemImage: "trash")
                        }
                    }
            }
        }
    }

}

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: DiegoMod1