UITableViewRowAction Deprecated

I have an app that uses Core Data with iCloud. The delete process works great. Now UITableViewRowAction is Deprecated. My questions are: Do I need to be concerned with that going forward anytime soon?

I have implemented UISwipeActionsConfiguration but for I reason I cannot get past after they delete an I reopen the App they re-appear.

Are there any write-ups you can point me to that can help me better understand what I am doing wrong?

override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {

        if editingStyle == .delete {

            // delete the row from the data source

            inspections.remove(at: indexPath.row)



        tableView.deleteRows(at: [indexPath], with: .fade)

        }

    }



     func  tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationsForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

        

        // Delete Button

         let deleteActions = UIContextualAction(style: .destructive, title: "Delete", handler: { (action, view, success) in

             print("Delete")

         })

         deleteActions.backgroundColor = .red

         if let appDelegate = (UIApplication.shared.delegate as? AppDelegate) {

                let context = appDelegate.persistentContainer.viewContext

                let inspectionsToDelete = self.fetchResultController.object(at: indexPath)

                context.delete(inspectionsToDelete)

                

                appDelegate.saveContext()

            }

//         completionHandler(true)

         

        return UISwipeActionsConfiguration(actions: [deleteActions])

Thanks AndrewG

Why don't you put

         if let appDelegate = (UIApplication.shared.delegate as? AppDelegate) {
               // …
           }

inside the handler ?

         let deleteActions = UIContextualAction(style: .destructive, title: "Delete", handler: { (action, view, success) in
             print("Delete")
             if let appDelegate = (UIApplication.shared.delegate as? AppDelegate) {
                let context = appDelegate.persistentContainer.viewContext
                let inspectionsToDelete = self.fetchResultController.object(at: indexPath)
                context.delete(inspectionsToDelete)
                appDelegate.saveContext()
             }
         })

         deleteActions.backgroundColor = .red

Starting a new post]

UITableViewRowAction Deprecated
 
 
Q