6

Is there a way to specify delete button title when editing list using built-in DeleteButton ?

Example code:

struct ExampleView: View {
    @State
    private var users = ["Paul", "Taylor", "Adele"]

    var body: some View {
        NavigationView {
            List {
                ForEach(users, id: \.self) { user in
                    Text(user)
                }.onDelete(perform: delete)
            }.navigationBarItems(trailing: EditButton())
        }
    }

    func delete(source: IndexSet) { }
}

The code gives (when edit is active):

Default delete button:

I want to place "some_text" instead of "Delete" -- is it possible with SwiftUI? Also, is it possible to change the delete title for one single row?

Stanislav Poslavsky
  • 2,398
  • 2
  • 24
  • 36
  • 1
    It can't be done - [SwiftUI - Custom Swipe Actions In List](https://stackoverflow.com/questions/57112426/swiftui-custom-swipe-actions-in-list) – gotnull Dec 04 '19 at 02:28
  • Here is a workaround https://stackoverflow.com/a/68318584/1122517 – Hwangho Kim Jul 09 '21 at 14:38

0 Answers0