Unable to remove Navigation Bar when TabView is used inside the Navigation View - SwiftUI - iOS 15

Viewed 456

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!

0 Answers
Related