I made some views ordering like Login -> Navigation Controller[Dashboard -> Detail]
In LoginViewController, There is Login Button and it has Action
@IBAction func loginTapped(_ sender: Any){
let mainNavigationController = storyboard?.instantiateViewController(withIdentifier: "MainNavigationViewController") as! MainNavigationViewController
present(mainNavigationController, animated: true, completion: nil)
}
In NagivationController
There are two Views,Dashboard and Detail
Detail View is pushed by segue action from Dashboard
and Dashboard has tab bar Item to logout
I know that when back button is tapped in Detail view, It doesn't deallocating Detail View. It just push back to Navigation Controller's Stack (Is it right...?)
but when i tapped Logout Button in Dashboard, I thought Navigation Controller which contains two views (Dashboard, Detail) should be deallocated
but it doesn't deallocated.
I set the deinit method in Navigation View Controller like this
deinit {
print("Main Navigation View Controller is deinited")
}
but it never called
How can i deallocate views that appear after login, when i tapped logout button
Sorry for poor syntax in English because i'm not Native