Remove Toolbar Item Margin
Configures whether the content margins are removed.
Platform Compatibility
Tags
SwiftUI Code
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)
}
}