Hi,
Os to possible to customize the icon, color, positioning of the SplitView ToolBar that shows at details view, the menu blue icon. add buttons to it ? change its color, icon, size ? position like adding paddings ?
Kind Regards
Currently you can't customize the appearance sidebarToggle. Please file an enhancement request – If you do so, please share your report ID here for folks to track.
You are allowed to remove the built in sidebarToggle using .toolbar(removing: .sidebarToggle)
and create a custom toolbar item using ToolbarItem(placement: .navigation)
.
However It won't completely appear as the built in sidebarToggle and it won't have the same behaviour.
Here's an example:
struct ContentView: View {
@State private var columnVisibility: NavigationSplitViewVisibility = .all
var body: some View {
NavigationSplitView(columnVisibility: $columnVisibility) {
List {
Text("Hello world")
}
.toolbar(removing: .sidebarToggle)
} detail: {
Text("Detail")
}
.toolbar {
ToolbarItem(placement: .navigation) {
Button {
withAnimation {
toggleSidebar()
}
} label: {
Image(systemName: "sidebar.left")
}
}
}
}
private func toggleSidebar() {
if columnVisibility == .all {
columnVisibility = .detailOnly
} else {
columnVisibility = .all
}
}
}