UIView not release
iBinh opened this issue · 2 comments
iBinh commented
addTapGesture or longGesture for UIView instance cause UIViewController not release when pop or dismiss
vhesener commented
Can you post some example code?
vhesener commented
Created a very simple app to show this is working as expected. Basically, a tap presents a new ViewController and a long press dismisses it. If you set a breakpoint in the deninit
method, you can see that the presented ViewController does not retain anything.
See below and try for yourself. Also check that you don't have any retain cycles in your closures.
import UIKit
import Closures
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.addTapGesture { [weak self] _ in
self?.present(ViewController(), animated: true)
}
view.addLongPressGesture { [weak self] _ in
self?.dismiss(animated: true)
}
}
deinit {
NSLog("deinitialized %@", self)
}
}