Skip to content

Instantly share code, notes, and snippets.

@JadenGeller
Created May 7, 2024 02:19
Show Gist options
  • Save JadenGeller/17577dac087f199f9143a52f3f57cf21 to your computer and use it in GitHub Desktop.
Save JadenGeller/17577dac087f199f9143a52f3f57cf21 to your computer and use it in GitHub Desktop.
Extend macOS toolbar downward in SwiftUI
import SwiftUI
extension View {
func toolbarAccessory(@ViewBuilder content: () -> some View) -> some View {
safeAreaInset(edge: .top) {
VStack(spacing: 0) {
content()
Divider()
}
.background(Material.bar, ignoresSafeAreaEdges: [.top])
}
.toolbarBackground(.clear, for: .windowToolbar)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment