Q:

Reloading TableView when a UIViewController is being dismissed?

The problem here is that I'm presenting EditCommentVC modally, over the current context of the CommentVC because I want to set the background of the UIView to semi-transparent. Now, on the EditCommentVC I have a UITextView that allows the user to edit their comment, along with 2 buttons - cancel (dismisses the EditCommentVC) and update  that updates the new comment and push it to the database.
In term of code, everything is working, except that once the new comment is being pushed and EditCommentVC is being dismissed, the UITableView on CommentsVC with all the comments is not being reloaded to show the updated comments. Tried calling it from viewWillAppear() but it doesn't work.
How can I reload the data in the UITableView in this case?
@IBAction func updateTapped(_ sender: UIButton) {
    guard let id = commentId else { return }
    Api.Comment.updateComment(forCommentId: id, updatedComment: editTextView.text!, onSuccess: {
        DispatchQueue.main.async {
            let commentVC = CommentVC()
            commentVC.tableView.reloadData()
            self.dismiss(animated: true, completion: nil)
        }
    }, onError: { error in
        SVProgressHUD.showError(withStatus: error)
    })

}

The code in the CommentVC where it transitions (and passes the id of the comment). CommentVC conforms to a CommentActionProtocol that passes the id of that comment: 
extension CommentVC: CommentActionProtocol {

    func presentActionSheet(for commentId: String) {
        let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
        let editAction = UIAlertAction(title: "Edit", style: .default) { _ in
            self.performSegue(withIdentifier: "CommentVCToEditComment", sender: commentId)
        }
        actionSheet.addAction(editAction)
        present(actionSheet, animated: true, completion: nil)

    }

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "CommentVCToEditComment" {
            let editCommentVC = segue.destination as! EditCommentVC
            let commentId = sender as! String
            editCommentVC.commentId = commentId
        }
    }

}

A:

I see atleast 2 problems here:

You are creating a new CommentVC which you should not do if you want to update the tableView in the existing view controller.
Since you have mentioned that Api.Comment.updateComment is a an asynchronous call, you need to write the UI code to run on the main thread.   

So first you need to have the instance of the commentVC in a variable inside this viewController. You can store the instance of the view controller from where you are presenting this view controller.
class EditCommentVC {

    var commentVCdelegate: CommentVC!   
    // Rest of your code

}

Now you need to pass the reference commentVC in this variable when you are presenting the edit view controller.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "CommentVCToEditComment" {
        let editCommentVC = segue.destination as! EditCommentVC
        let commentId = sender as! String
        editCommentVC.commentId = commentId
        editCommentVC.commentVCdelegate = self
    }
}

Now you need to use this reference to reload your tableView.
Api.Comment.updateComment(forCommentId: id, updatedComment: editTextView.text!, onSuccess: {
    DispatchQueue.main.async {
        commentVCdelegate.tableView.reloadData() // - this commentVC must be an instance that you store of the your commentVC that you created the first time
        self.dismiss(animated: true, completion: nil)
    }
}, onError: { error in
    SVProgressHUD.showError(withStatus: error)
})

