My specific case is I am trying to toggle the nav bar hidden and showing.
let navHidden = !self.navigationController?.navigationBarHidden
self.naviga
navHidden is an optional. And you explictely unwrap that optional (which means you get a crash if navHidden is nil). Clearly something is wrong here. I suggest
if let navController = self.navigationController {
let navHidden = navController.navigationBarHidden
navController.setNavigationBarHidden (!navHidden, animated:true)
}