3

SwiftUI View Hierarchy Navigation View --> VStack --> Custom SearchView --> TabView

In the view, with the hierarchy mentioned above, I'm unable to remove navigation bar. It's visibility is successfully changed with the code mentioned shared below.

@available(iOS 15.0, *)
func iOS15UIBarSpecs(){
    let navBarAppearance = UINavigationBarAppearance()
    
    navBarAppearance.configureWithTransparentBackground()
    navBarAppearance.backgroundColor = UIColor.red.withAlphaComponent(0.5)
    navBarAppearance.shadowImage = UIImage()
    navBarAppearance.shadowImage = nil
    navBarAppearance.shadowColor = nil
        
    
    UINavigationBar.appearance().standardAppearance = navBarAppearance
    UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
}

The presence of this navigation bar is blocking tap gestures on any view coming behind it.

The same view was working fine in iOS 14 with the following line of code.

  .navigationBarHidden(true)

Any help would be much appreciated. Thanks!

Subhan Ali
  • 1,370
  • 13
  • 17

0 Answers0