I am trying to upgrade code of my project and found this warning
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let deleteRowAction = UITableViewRowAction(style: .destructive, title: deleteActionTitle) { [unowned self] (_, indexPath) in
//code you want to execute }
return [deleteRowAction]
}
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let contextItem = UIContextualAction(style: .destructive, title: deleteActionTitle) { (contextualAction, view, boolValue) in
//Code I want to do here
}
let swipeActions = UISwipeActionsConfiguration(actions: [contextItem])
return swipeActions
}
You can use the UISwipeActionsConfiguration
over UITableViewRowAction
such as
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
return UISwipeActionsConfiguration()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With