Removing title bar on Catalyst doesn't work on Ventura

I would like to remove the title bar of the catalyst version of my app, but it does not work on Ventura. It used to work on Monterey. I am using AppDelegate lifecycle. I am following the official documentation: https://developer.apple.com/documentation/uikit/mac_catalyst/removing_the_title_bar_in_your_mac_app_built_with_mac_catalyst

The code:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    
    guard let windowScene = (scene as? UIWindowScene) else { return }
    
    #if targetEnvironment(macCatalyst)
    if let titlebar = windowScene.titlebar {
        titlebar.titleVisibility = .hidden
        titlebar.toolbar = nil
    }
    #endif

}

I've run into this same problem, particular when the main view is hosted by a UISplitViewController. An empty title bar is always shown above the secondary pane, when building under Xcode 14 (14.0 and the 14.1 beta) and running under Ventura. The problem is resolved when building under Xcode 13, but that locks out new features.

As it is now, we are likely going to have to fork the code and build the Mac version under Xcode 13 and continue with iOS/iPadOS under Xcode 14.

If your UI use UINavigationController (which of course contain UINavigationBars) then you are likely seeing the NavigationBar-in-NSToolbar hosting that is done by default for iOS 16 linked apps. If you want to disable this then you need to set the preferredBehavioralStyle of each UINavigationBar to .pad

If your UI use UINavigationController (which of course contain UINavigationBars) then you are likely seeing the NavigationBar-in-NSToolbar hosting that is done by default for iOS 16 linked apps. If you want to disable this then you need to set the preferredBehavioralStyle of each UINavigationBar to .pad

Unfortunately, setting preferredBehavioralStyle to .pad will show the title bar under Ventura, even if the title bar should be hidden. Below are screenshots from a quick demo project I created, the first is built against the Xcode 14 and Catalyst 15, the second is built under Xcode 14.1 and Catalyst 16 with preferredBehavioralStyle set to .pad:

This is a problem if you are hosting everything inside of a UISplitViewController and want to run the secondary view all the way to the top of the UI. Before, you could even do this with navigation controllers by setting additionalSafeAreaInsets.top to a negative value matching the height allotted for the title bar, but doing so under Catalyst 16 with preferredBehavioralStyl set to .pad gives you this instead, where you can see the navigation bar hidden under the title bar that is supposed to be disabled:

The only workable solution I have found (beyond building against Catalyst 15, which precludes newer features) is to use the leadingItemGroups, centerItemGroups, and trailingItemGroups properties of UINavigationItem when running under Ventura instead of leftBarButtonItem, titleView, and rightBarButtonItem.

This works (mostly), but makes maintaining the codebase for backward compatibility more difficult by adding conditionals every time you need to deal with a navigation item. Yes, you can abstract this out, but even then, for a large codebase it adds additional risk of breaking previously working behavior.

Also, there seems to be a problem with clipping the hosted view. If you look at the example below, you can see the segmented control in the center has its border clipped along the top and sides:

Ideally, setting preferredBehavioralStyle set to .pad would give the prior behavior across the board, making everything much easier to maintain for backward compatibility purposes. I think this is particular important on the Mac as, at least in our case, we have found our Mac customers tend to upgrade their OS and hardware at a much, much slower rate than with iOS. And with subscription-based software, it is important to make newer features in the app itself available to these users.

Please file a feedback about this issue. A simple sample project would also be appreciated!

Same issue here. Thank you all for the information. I also tried various hacks, but none of them worked. It's just too painful, I'll stop fixing it for now and wait for a solution.

Thank you for the detailed report. The issue still exists in Xcode 14.1 and the official Ventura 13.0 release. This approach is not going to work for advanced apps and I'll have to revert to Xcode 13 until there is a solution.

Just realized that this problem only appears when "Optimized for Mac" is selected for the catalyst user interface idiom. Selecting "Scaled to Match iPad" has no problem.

The problem seems to be fixed in macOS Ventura 13.1 Beta 2. Thank you Apple engineers for taking care of this!

Hi, looks like the issue is not fixed in macOS Ventura 13.1 public release, what to do about this? Best, Valerio.

Still got this issue.It's hurt me a lot!

Using AppKit and this is still a problem in ventura, xcode 14+

Removing title bar on Catalyst doesn't work on Ventura
 
 
Q