NavigationSplitView crashes when hiding sidebar with Toolbar as "Icon and Text"

33 views Asked by At

My application is crashing when I try to hide the sidebar with the icon provided for me by the system. But it will only crash when the toolbar style is "Icon and Text"

I made a small sample application and it can easily be reproduced.

Any way around this crash?

struct ContentView: View {

    @State var sideBarVisibility : NavigationSplitViewVisibility = .doubleColumn

    var body: some View {
    
        NavigationSplitView(columnVisibility: $sideBarVisibility) {
            Text("Sidebar")
        }
        detail : {
            Text("Detail")
        }
        .toolbar (id: "main") {
            ToolbarItem(id: "files") {
                Button(action: { /* do nothing */ } ) {
                    Label("Select Files", systemImage: "folder.badge.plus")
                }
            }
        }
    }
}

enter image description here

0

There are 0 answers