Skip to content

.toolbar(.hidden) doesn't behave like iOS #308

@dfabulich

Description

@dfabulich

https://github.com/skiptools/skipapp-showcase/blob/main/Sources/Showcase/ToolbarPlayground.swift

In the Toolbar Playground, there's a "Hide Bars" playground.

case .hideBars:
    #if os(macOS)
    Text("Not supported on macOS")
    #else
    HideToolbarsPlayground()
        .navigationTitle($0.title)
        .toolbar(.hidden)
        .ignoresSafeArea()
    #endif

On iOS, this playground hides the navigation bar, leaving the bottom tab bar visible. On the "Medium Phone API 36" Android emulator, it hides both the navigation bar and the bottom tab bar.

https://developer.apple.com/documentation/swiftui/view/toolbar(_:for:)

Parameters

visibility

The preferred visibility of the bar.

bars

The bars to update the visibility of or automatic if empty.

https://developer.apple.com/documentation/swiftui/toolbarplacement/automatic

Depending on the context, this may refer to the navigation bar of an app on iOS, or watchOS, the tab bar of an app on tvOS, or the window toolbar / window titlebar of an app on macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions