Q:

How to implement UIActivityIndicator with swipe to delete for Table View Cell

I have a table view with swipe to delete functionality. As soon as I tap delete I want the activity indicator to start animating for that cell and once the background network call is finished I want to stop animation.
Below is my code. Activity Indicator doesn't work.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    if editingStyle == .delete {

        let r = self.tableView(tableView, cellForRowAt: indexPath)

         let indicator = r.viewWithTag(136) as! UIActivityIndicatorView
        indicator.startAnimating()

        let user = fetchedResultsController.object(at: indexPath) as! SharableUser
        deletee(user: user){

            self.managedObjectContext.performAndWait {

                DispatchQueue.main.sync {
                    indicator.stopAnimating()

                    }
                }

                user.accept = 0
                saveData(inContext: self.managedObjectContext)

            }
        }

    }

}

A:

Replace
let r = self.tableView(tableView, cellForRowAt: indexPath)

with
let r = self.tableView.cellForRow(at: indexPath)!

and it's better to make outlet than using view tags 

