'Globally hide navigation bar in SwiftUI project
I would like to globally hide the navigation bar, so I don't need to do .navigationBarHidden(true) on each view's onAppear.
Is there a global way to do that?
Thanks
Solution 1:[1]
You can use extension of NavigationController to handle its visibility on global level like this
extension UINavigationController{
open override func viewWillLayoutSubviews() {
setNavigationBarHidden(true, animated: false)
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Umair Khan |
