Post

Replies

Boosts

Views

Activity

Reply to NavigationSplitView hide sidebar toggle button
I'm a newbie in SwiftUI development, but I had the same question for my macOS application. The answer I've found seems a little bit ugly, but using SwiftUI-Introspect library you can just remove corresponding toolbar item. Maybe it will be helpful for someone. .introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { nsWindow in if let toolbar = nsWindow.toolbar { if let index = toolbar.items.firstIndex(where: { $0.itemIdentifier.rawValue == "com.apple.SwiftUI.navigationSplitView.toggleSidebar" }) { toolbar.removeItem(at: index) } } }
Aug ’23