I know it's all with the weak strong reference when presenting the viewController in the parent view ... correct me please if I'm wrong
this is an example how I do it
let viewHolder = viewClass()
func presentView() {
self.present(viewHolder, animated: true) {
}
}
see my memory monitor only from open and dismiss the same view over and over
weak var viewHolder = viewClass()
func presentView() {
self.present(viewHolder!, animated: true) {
}
}
but this would give me a crash
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
and dismiss the viewClass this way (inside itself off)
func dismissPage() {
self.dismiss(animated: true)
}
any help would be appreciated thanks

The problem might not be in the
viewClass. You are declaringlet viewHolder = viewClass()in your initial class. So when you dismiss the controller, that variable still exists. Do you need to keep a reference to it? If not, you can easily allocate it when needs to be displayed and when you dismiss it, the memory is going to be freed: