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?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.