In my setup I hold Card reference inside another ViewController, so schematically the code looks like follow:
class MyAlert: UIViewController {
public var customView: UIView? = nil // here I hold my Card
}
class MyTableViewController {
deinit {
print("MyTableViewController: deinit")
}
func showAlertWithCard {
let card = CardHighlight(frame: CGRect(x: 10, y: 0, width: screenSize.width-20 , height: 240.0 ))
card.icon = UIImage(named: "flappy")
card.title = "Welcome \nto \nCards !"
card.itemTitle = "Flappy Bird"
card.itemSubtitle = "Flap That !"
card.textColor = UIColor.white
card.hasParallax = true
let cardContentVC = storyboard!.instantiateViewController(withIdentifier: "CardContent")
card.shouldPresent(cardContentVC, from: self, fullscreen: false)
let alert = MyAlert()
alert.showInView = self.view
alert.customView = card
alert.show()
}
}
unfortunately deinit on MyTableViewController is never called until I change the definition of suprVC inside Card class from strong (default) to weak as follow:
weak var superVC: UIViewController?
Would be nice to have this fix it in the official code without need to patch it locally.
In my setup I hold Card reference inside another ViewController, so schematically the code looks like follow:
unfortunately
deinit
onMyTableViewController
is never called until I change the definition ofsuprVC
insideCard
class fromstrong
(default) toweak
as follow:Would be nice to have this fix it in the official code without need to patch it locally.