Hi,
If Im in detailsOnly mode in SplitView how to manually open the SideBar as popover same as behavior as default rectangle menu icon at top of Details View.
Kind Regards
Hi,
If Im in detailsOnly mode in SplitView how to manually open the SideBar as popover same as behavior as default rectangle menu icon at top of Details View.
Kind Regards
You can programmatically toggle the columnVisibility by creating a State value of type NavigationSplitViewVisibility.
For example
struct ContentView: View {
@State private var columnVisibility: NavigationSplitViewVisibility = .detailOnly
var body: some View {
NavigationSplitView(columnVisibility: $columnVisibility) {
Text("Hello world")
} detail: {
Button("Toggle columnVisibility") {
toggleSidebar()
}
}
}
private func toggleSidebar() {
if columnVisibility == .all {
columnVisibility = .detailOnly
} else {
columnVisibility = .all
}
}
}