Change "Delete Text" on Swipe Eureka

133 Views Asked by At

Is there a way to change the text of the ContextualAction so it doesn't say "delete" anymore?

This is the Delete Button that I'm talking about

1

There are 1 best solutions below

2
Abdul Karim Khan On

You can simply create delegate method, trailingSwipeActionsConfigurationForRowAt like below and customise it as you want:

extension YOURVIEWCONROLLER: UITableViewDelegate{
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

    let removeAction = UIContextualAction(style: .destructive, title: "Remove") { action, view, complete in
        //Your code
        Utility.main.showAlert(message: "Removed Pressed", title: "Alert")
        complete(true)
    }
    doneAction.backgroundColor = UIColor.red

    return UISwipeActionsConfiguration(actions: [removeAction])
}
}

Or

In Core.swift file you need to edit its function.