I'm presenting a view controller inside a UIAction handler from the new UIButton init configuration API. But when I do it, its deinit won't get called.
I'm thinking there's some sort of retain cycle? I've tried capturing [weak self] inside the closure with no success. Using the addTarget method instead, the deinit gets called as expected.
What am I doing wrong?
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
}()