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

}
Post not yet marked as solved Up vote post of viktor2000 Down vote post of viktor2000
3.4k views

Replies

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.

  • Exactly the same issue. The problem is that I would like (and already have) implemented many Ventura-only features. I have managed to hide it when it enters the full screen with this line of code: titlebar.autoHidesToolbarInFullScreen = true

  • I have also filed feedback: FB11624143

Add a Comment

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!

  • FB11507444 has the sample project used above, with the exception of the 3rd screenshot with the title bar drawn with UISplitViewController. I will update it with the information above to add more clarity.

    If possible, there is another feedback I filed regarding the shadow drawn at the top of a UICollectionView using a list configuration when it it scrolled. This shadow overlays any view that may be shown on top of the collection view, resulting is an ugly visual artifact (FB11612854).

  • FB11647680 - includes a sample project where titlebar should not be visible yet is on Ventura betas. Thanks anonymous frameworks engineer ;-)

  • I just filed FB11742108 with an attached sample project as well. Thanks!

Add a Comment

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.

  • We’re staying at Xcode 14.0 because it has the previous Catalyst SDK but we can still take advantage of some new features in iOS. Can’t use Xcode 14.1 until this and the shadow issue with UICollectionView in Catalyst is resolved though.

Add a Comment

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!

  • Thanks for the information! 👏

  • Hello, to me it looks like that it's NOT fixed in macOS Ventura 13.1 just released to the public. Any ideo on what we can do about it?

  • Hi, looks like the issue is not fixed in macOS Ventura 13.1 public release. Any clue on what to do for this issue? Best, Valerio.

Add a Comment

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!

  • Did you try setting the preferredBehaviorStyle to .pad for UINavigationBar's appearance? Something like this:

    if #available(macCatalyst 16.0, *) { UINavigationBar.appearance().preferredBehavioralStyle = .pad }

Add a Comment

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