I have a main UINavigationController for the App and now I wanted to present another navigationController for another flow. After completing the flow, I'm dismissing the another NavigationCotnroller but the rootViewController of another NavigationController is not getting deallocated.('deinit' is not getting called on rootViewController of another navigation controller).
below is example code to understand -
// main Navigation controller for the app
let navigationController = UINavigationController()
//another navigation controller to present separate flow of screens
let rootController = UIViewController()
let subNavigationController = UINavigationController(rootViewController: rootController)
navigationController.present(subNavigationController, animated: true, completion: nil)
//while dismiss - deinit on rootController is not getting called
navigationController.dismiss(animated: true, completion: nil)
navigationController.viewcontrollers?.first?.navigationController?.dismiss(animated: true)
– CrackIt