You can now hide the sidebar button, but how to prevent the sidebar from closing (like the settings app, or the Music app...)
import Foundation
import SwiftUI
struct ContentView:: View {
@State private var columnVisibility = NavigationSplitViewVisibility.detailOnly
var body: some View {
NavigationSplitView(columnVisibility: $columnVisibility) {
List {
Text("dd")
}
.toolbar(removing: .sidebarToggle)
} detail: {
VStack{
Button("Expand"){
columnVisibility = .all
}
}
.toolbar{
ToolbarItem{
Button(action:{
}){
Image(systemName: "square.and.arrow.up")
}
}
}
}
}
}
.constant(.all) was also not possible
import Foundation
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationSplitView(columnVisibility: .constant(.all)) {
List {
Text("dd")
}
.toolbar(removing: .sidebarToggle)
} detail: {
VStack{
Text("dd")
}
.toolbar{
ToolbarItem{
Button(action:{
}){
Image(systemName: "square.and.arrow.up")
}
}
}
}
}
}