I like the sidebar to be opened at launch.
However when I build and run the app, this is what I get.
So I need to click on the sidebar icon to show it. This is not the behavior I want. Is it possible to change this?
CodePudding user response:
Just add some component to the sidebar: part, then the left side bar will be shown(code is below the image).
NavigationSplitView(sidebar: {
Text("Side bar")
}, detail: {
Text("Main part")
})
CodePudding user response:
@State private var columnVisibility =
NavigationSplitViewVisibility.doubleColumn
var body: some View {
NavigationSplitView(columnVisibility: $columnVisibility) {
Text("Side bar")
} detail: {
Text("Main part")
}
}