iPhone SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.

Toolbars

Remove Toolbar Item Margin

Configures whether the content margins are removed.

Explore Remove Toolbar Item Margin on iPhone in portrait, with SwiftUI code and Apple API documentation.

NavigationStack {
    Text("FooBar")
        .toolbar {
            ToolbarItem {
                Text("Foo")
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                    .background(.blue.tertiary)
            }
            ToolbarSpacer()
            ToolbarItem {
                Text("Bar")
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                    .background(.blue.tertiary)
            }
            .contentMarginsRemoved(true)
        }
    }
iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+

Every available iPhone screenshot for Remove Toolbar Item Margin.

1 views