I found a way to programmatically select a row in my tableView through using the delegate
method like suggested in this answer:
https://stackoverflow.com/a/40589905/3511695
Right now I have a .delete
editingStyle
option for each of my tableView's cells:
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if (editingStyle == .delete) {
// code that's called when user presses delete button
}
How could I call this delete
function programmatically? i.e. Simulate the user pressing the delete
button? (Just like how I was able to programmatically simulate pressing a tableView cell)
I have an alertController
in my if (editingStyle == .delete) {}
that I need to have show up again, which is why I need to programmatically simulate the user pressing the Delete button in the UI rather than simply deleting the row.