Post

Replies

Boosts

Views

Activity

Reply to The issue of toolbar item size when windowToolbarStyle is unifiedCompact
i found a way by myself import SwiftUI @main struct ThreeSideViewerApp: App { var body: some Scene { WindowGroup { ContentView() } .windowToolbarStyle(.unifiedCompact) } } struct ContentView: View { @State var show: NavigationSplitViewVisibility = .all var body: some View { NavigationSplitView(columnVisibility: $show) { Text("SideBar") .toolbar(removing: .sidebarToggle) // remove default add .toolbar { ToolbarItem { // add my self Button(action: { // use animeatino to toggle withAnimation { if show == .all { show = .detailOnly } else { show = .all } } }, label: { // set large Image(systemName: "sidebar.leading").imageScale(.large) }) } } } detail: { Text("detail") } } }
Oct ’23