Created
May 7, 2024 02:19
-
-
Save JadenGeller/17577dac087f199f9143a52f3f57cf21 to your computer and use it in GitHub Desktop.
Extend macOS toolbar downward in SwiftUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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