Skip to content

Another way to hide TabBar on NSTabView #506

@VirgilClyne

Description

@VirgilClyne

Description

Another way to hide tabbar on NSTabView

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
                    }
                }
            }

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions