Warning core data

swift

#1

Как убрать warning?

override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    let context = appDelegate.persistentContainer.viewContext
    
    
    guard let taskDelete = toDoItems.remove(at: indexPath.row) as? Task,  editingStyle == .delete else {
        return
    }
    context.delete(taskDelete)
    
    do {
        try context.save()
        tableView.deleteRows(at: [indexPath], with: .automatic)
    } catch let error as NSError {
        print("Error: \(error), description")
    }
}


#2
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    let context = appDelegate.persistentContainer.viewContext


    guard editingStyle == .delete else {
        return
    }

    let taskDelete = toDoItems.remove(at: indexPath.row)
    context.delete(taskDelete)

    do {
        try context.save()
        tableView.deleteRows(at: [indexPath], with: .automatic)
    } catch let error as NSError {
        print("Error: \(error), description")
    }
}