TabView{}
.introspect(.window, on: .macOS(.v15, .v26)) { window in
guard let toolbar = window.toolbar else { return }
for item in toolbar.items {
if item.label == "Navigation Tab Bar" {
// Remove border
item.isBordered = false
// Hide item instead of removing to avoid system recreation
item.view?.isHidden = true
// Set width to 0 using constraints to prevent occupying toolbar space
item.view?.widthAnchor.constraint(equalToConstant: 0).isActive = true
}
}
}
Description
Another way to hide tabbar on NSTabView
Checklist
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
Version information
No response
Destination operating system
No response
Xcode version information
No response
Swift Compiler version information