navigationBar.isHidden is not working in Swift 5.7, iOS 16

Xcode 14.0.1

Swift 5.7

iOS 16

SwiftUI

Originally, I hide ALL navigation bars in SwiftUI by below codes.

extension UINavigationController: ObservableObject, UIGestureRecognizerDelegate {
  override open func viewDidLoad() {
    navigationBar.isHidden = true
    super.viewDidLoad()
  }

  // ... and also navigationBar.isHidden = true in viewWillAppear, viewWillDisappear
}

But after I update my Xcode, Swift and iOS version, it doesn't work. Navigation bars starts to show on views.

Is there any changes about UINavigationController in this version? How to fix this?

Thank you.

navigationBar.isHidden is not working in Swift 5.7, iOS 16
 
 
Q