iPadOS 15 bug : NavigationBar exposed by SwiftUI Hosting

I have found a bug in iPadOS 15 in a UIKit app that is a legacy Objective-C app.

This app has full screen presentation and uses UINavigationView at the top level, from the UIApplicationDelegate.

In the UIApplicationDelegate the UINavigationBar is hidden, and does not become visible again in the app.

This app has functioned correctly for years, but recently I decided to try adding a hosted SwiftUI view as a view controller component.

The way this works is that I create a Container view controller that hosts the SwiftUI

UINavigationController 
 - ParentUIViewController  
 - ContainerUIViewController  
        - HostingViewController
             -  SwiftUI View.  

The ContainerUIViewController contains logic for instantiating the hosted SwiftUI view and performing correct child view controller insertion and removal from the container.

This worked on iPadOS 14, but on iPadOs 15 the presentation of the hosted SwiftUI view causes the NavigationBar to appear.

Once presented it cannot be hidden by commands to hide the bar on any of the views in the hierarchy, it is persistent. I've tried hiding on the SwiftUI hosted view, and on the container and everywhere I can see that makes sense.

It will take some time to create a sample app so I can send this to Apple as a defect, if anyone in the meantime has come across this or has a solution that would be great as I'll need to switch back to UIKit for all my view controllers if this is not resolvable without an iPadOS upgrade.

I found a solution that works on both iPadOS 14 and 15.

In my ContainerUIViewController I was assembling and inserting the child view controller in viewWillAppear As the final step I was calling setNavigationBarHidden to true. This worked as desired in iPadOS 14.

Moving this to viewDidAppear meant that the command to setNavigationBarHidden worked correctly. With animation set to 'false' there is no visual appearance of the NavigationBar. I was concerned that handling it after parent view appearance would result in some kind of visual noise, but it wasn't the case.

iPadOS 15 bug : NavigationBar exposed by SwiftUI Hosting
 
 
Q