I have two view controllers in a navigation controller. I'm trying to change the tint color of the navigation bar for each view controller.
I'm using the following code to accomplish this:
FirstVC:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
navigationController?.navigationBar.barTintColor = .yandasRed
navigationController?.navigationBar.isTranslucent = false
}
SecondVC:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
navigationController?.navigationBar.barTintColor = .white
navigationController?.navigationBar.isTranslucent = true
}
The transition between FirstVC to SecondVC is seemless, and looks great. However when I go back to the FirstVC from the SecondVC, there is a delay in changing the navigation bar tint color. About 1/2 a second.
Why is this? I was under the impression that all code inside viewWillAppear is executed before the view controller is loaded.