-1

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

Philip Dz
  • 91
  • 1
  • 11

1 Answers1

0

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.

Abdul Karim Khan
  • 4,256
  • 1
  • 26
  • 30
  • I already tried that & it doesn't work the way I want it. Since I'm working with the Eureka framework I wanted to know if there is a built-in method to change the text. Unfortunately your solution doesnt work in this case. – Philip Dz Mar 23 '20 at 12:13
  • @PhilipDz edit tableview delegate function in core.swift file. – Abdul Karim Khan Mar 23 '20 at 12:36