hidden(_:)
Hides a toolbar item within its toolbar.
Declaration
nonisolated func hidden(_ hidden: Bool = true) -> some ToolbarContent
Parameters
- hidden:
Whether the toolbar item is hidden.
Discussion
Use this modifier to conditionally display a toolbar item in the toolbar.
struct ContentView {
@State private var showDownloads = false
var body: some View {
BrowserView()
.toolbar {
ToolbarItem {
DownloadsButton()
}
.hidden(!showDownloads)
}
}
}