Prevent NavigationView Sidebar from collapsing Sidebar by default

I am attempting to build a simple Sidebar / List / Detail split view using the new SidebarListStyle(). An item must be selected in the Sidebar for the List to render its items.

By default NavigationView collapses the Sidebar, so on initial launch of the app the user has to click the expand button, or if on the iPhone, has to navigate back two screens. I want the Sidebar to appear by default.

Is there a way to do this?

Code Block swift
var body: some View {
SidebarListView()
DocumentListView(projectUUID: nil)
DocumentView(document: nil)
}


If I wrap DocumentListView and DocumentView in a conditional, they will render as a VStack, instead of the nice three column split view.

Answered by jcontonio in 641609022
For anyone that runs into this problem, just use UISplitViewController via UIViewControllerRepresentable. You'll get all the control you want, since NavigationView provides you none.
Accepted Answer
For anyone that runs into this problem, just use UISplitViewController via UIViewControllerRepresentable. You'll get all the control you want, since NavigationView provides you none.
Prevent NavigationView Sidebar from collapsing Sidebar by default
 
 
Q