How to remove top space of principal ToolbarItem in sidebarAdaptable TabView

When creating a principal ToolbarItem in a sidebarAdaptable TabView, unwanted space appears at the top.

Here's my code:

struct ContentView: View {
    var body: some View {
        TabView {
            Tab("Tab", systemImage: "star") {
                NavigationStack {
                    Text("Hello, World!")
                        .toolbar {
                            ToolbarItem(placement: .principal) {
                                Text("↑ Space")
                            }
                        }
                        .navigationBarTitleDisplayMode(.inline)
                }
            }
        }
        .tabViewStyle(.sidebarAdaptable)
    }
}

I would like to know how to remove this space.

Environment:

  • Xcode 16.2.0
  • iOS 18.2

Here's a screenshot from the simulator:

That seems to be for the TitleBar. On iOS or IpadOS, there's no API to hide the title bar specificaly. You could have to hide the navigationBar using .toolbar(.hidden, for: .navigationBar).

Could you file an enhancement request via Feedback assistant and post the Feedback number here for the record.

How to remove top space of principal ToolbarItem in sidebarAdaptable TabView
 
 
Q