class ViewController: UIViewController, UINavigationControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
navigationController!
didShowViewController
is called twice because the first time it is called when the navigation controller transitions to showing the view controller. And then it is called again by the navigation controller's own viewDidAppear
when it appears on screen, using the topViewController
as the controller param which in this case is the same as the controller the first time it was called.