Should I capture `tableView` in this closure?

Viewed 78

I have this code sample with a closure that has a capture list of self:

override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
        let dismiss = UITableViewRowAction(style: .destructive, title: "Dismiss") { [weak self] _, indexPath in
            let cell = tableView.cellForRow(at: indexPath)
            self?.dismissIssue(cell)
        }
        return [dismiss]
    }

Should I put the tableView on the capture list? How to reason about it?

1 Answers

No, the passed tableView instance is a local instance. It doesn't cause a retain cycle

Related