Удаление ячеек в tableViewController через trailingSwipeActionsConfigurationForRowAt indexPath

Суть в том, что у меня xcode ругаться на эту строку tableView.deleteRows(at: [indexPath.row], with: .automatic), а по другому я, что то не очень понимаю, как можно удалить строку по индексу. А ругается так "Cannot convert value of type 'Int' to expected element type 'Array.ArrayLiteralElement' (aka 'IndexPath')"

override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let place = places[indexPath.row]
   
    let deliteAction = UIContextualAction(style: .normal, title: "Удалить") { (_ , _, completionHandler) in
        
        StoregeMagager.deliteObject(place)
        tableView.deleteRows(at: [indexPath.row], with: .automatic) 
        completionHandler(true)
    }
    let swipe = UISwipeActionsConfiguration(actions: [deliteAction])
    return swipe
}

Ответы (1 шт):

Автор решения: schmidt9

Метод deleteRows принимает массив [IndexPath], поэтому попробуйте

tableView.deleteRows(at: [indexPath], with: .automatic)
→ Ссылка