I have two UIViewController
. First one is a welcome screen and second one is a login screen (which is inside a navigation Controller). Users can go back to welcome screen from login screen with a back button so login screen opens with self.present(LoginViewController(),animated: false)
and after Login Screen, final UIViewController
opens with appDelegate.window?.rootViewController = FinalViewController()
.
My problem is that neither LoginViewController
or WelcomeViewController
deinit at this scenario. However, If I;
- Open
FinalViewController
(via changing RootViewController) directly fromWelcomeViewController
, without showingLoginViewController
. - Open
LoginViewController
without showingWelcomeViewController
then openFinalViewController
(again changing RootViewController)
Controllers deinited. So I don't think any of viewcontroller has a retain cycle vs..
I want to deinit both login and welcome screens after open final controller.
EDIT: I found that putting it inside NavigationController blocks the deniting.
EDIT2: If I call self.dismiss(animated: false, completion: nil)
before changing rootViewController. All controllers seems to be deinited but I'm not sure If It will be a better answer.