Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hides navigation bar for current controller and shows it smoothly on push and hides it on pop.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let navigationController = navigationController,
presentedViewController == nil {
navigationController.setNavigationBarHidden(true, animated: true)
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if let navigationController = navigationController,
presentingViewController != nil {
navigationController.setNavigationBarHidden(false, animated: true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.