Skip to content
RED SAGSkills
hard20 pts · first answer countsswiftmemory-management

Memory leak with a closure

This view controller is never deallocated after it is dismissed. Why?

class ProfileVC: UIViewController {
  var onUpdate: (() -> Void)?
  override func viewDidLoad() {
    super.viewDidLoad()
    onUpdate = {
      self.reload()
    }
  }
  func reload() {}
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions