I have a FakeSplashController which does some network requests and after that open WelcomeViewController. When I look memory graph in WelcomeViewController, I see that SplashViewController is still in there. I'm calling deinit function in FakeSplashController to check If It is deniniting but It doesn't call it. What can be the problem?
What I see in Memory when in WelcomeViewController:

FakeSplashController:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setupUI()
networkRequests()
}
func networkRequests(){
AppInitService().initAppRequest { [](result) in
switch result{
case .success(_):
self.startAnimation()
return
case .error(let error):
UIControlUtil.showErrorMessage(title: error.title, message: error.message, closeButton: true)
return
}
}
}
func openApp(){
let loginController = WelcomeViewController()
self.present(loginController, animated: true)
}
func startAnimation(){
UIView.animate(withDuration: 0.8, animations: {
self.logoImage.frame.origin.x -= 100
}, completion: nil)
UIView.animate(withDuration: 1,delay: 0.3,animations: {
self.textLogo.alpha = 1
self.textLogo.frame.origin.x += 50
}, completion: { _ in
self.openApp()
})
}
deinit {
print("Splash Deinited")
}
EDIT: As I red in below post, someone mentioned that;
Unless you're doing something very specialized, you don't need to de-init an object in Swift. It will be called automatically when the reference count goes to 0. If you really need to, you should be able to set you window's rootViewController through your AppDelegate.
So don't I need to take this as a problem? Best way to deinit Initial view controller?
WelcomeViewController?WelcomeViewControlleryou'll see the splash again