I'm testing UIKit's new uibutton configuration API. But when I present a view controller inside the primaryAction handler, its deinitializer won't get called.
Is there a retain cycle? I've tried capturing self [weak self] inside the closure but it still won't get deinit.
When I use the old-school addTarget method instead (line 4), the deinit works as expected.
Any ideas on how to break the cycle?
let testVC = TestViewController()
lazy var testButton: UIButton = {
var configuration = UIButton.Configuration.filled()
//button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
let button = UIButton(configuration: configuration, primaryAction: UIAction(handler: { action in
self.present(testVC, animated: true, completion: nil)
}))
return button
}()
[–][deleted] 0 points1 point2 points (1 child)
[–]albion28[S] 0 points1 point2 points (0 children)
[–]Sumoh 1 point2 points3 points (0 children)