Use the native Sidebar background material
This commit is contained in:
1 parent
58bd6ae364
commit
36f3c0bab8
2 files changed
+14
-28
No files matched your search
+14
-10
@@ -31,16 +31,20 @@ struct RootView: View {
|
||||
@Bindable var presentations = window.presentations
|
||||
|
||||
NavigationSplitView(columnVisibility: sidebarVisibility) {
|
||||
ZStack {
|
||||
SidebarGlassBackground()
|
||||
.ignoresSafeArea()
|
||||
WindowSidebarView()
|
||||
}
|
||||
.navigationSplitViewColumnWidth(
|
||||
min: Metrics.Sidebar.min,
|
||||
ideal: min(Metrics.Sidebar.ideal, sidebarMaxWidth),
|
||||
max: sidebarMaxWidth
|
||||
)
|
||||
WindowSidebarView()
|
||||
.background {
|
||||
// Modern split views supply the system sidebar material.
|
||||
// An additional glass surface changes its tint and contrast.
|
||||
if #unavailable(macOS 26.0) {
|
||||
LegacySidebarMaterialBackground()
|
||||
.ignoresSafeArea()
|
||||
}
|
||||
}
|
||||
.navigationSplitViewColumnWidth(
|
||||
min: Metrics.Sidebar.min,
|
||||
ideal: min(Metrics.Sidebar.ideal, sidebarMaxWidth),
|
||||
max: sidebarMaxWidth
|
||||
)
|
||||
} detail: {
|
||||
detail
|
||||
// Floating over the pane rather than docked under it, so switching
|
||||
|
||||
@@ -444,24 +444,6 @@ private struct TermindGlassBar: ViewModifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Liquid Glass surface shared by every mode of the left column.
|
||||
///
|
||||
/// `NavigationSplitView` supplies the column geometry, but the custom AppKit
|
||||
/// lists inside it do not inherit SwiftUI's source-list background. Hosting one
|
||||
/// system glass surface behind the complete column keeps list rows and empty
|
||||
/// space on one coherent material, including behind the window titlebar.
|
||||
struct SidebarGlassBackground: View {
|
||||
@ViewBuilder
|
||||
var body: some View {
|
||||
if #available(macOS 26.0, *) {
|
||||
Color.clear
|
||||
.glassEffect(.regular, in: .rect)
|
||||
} else {
|
||||
LegacySidebarMaterialBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Native material fallback for systems before Liquid Glass.
|
||||
struct LegacySidebarMaterialBackground: NSViewRepresentable {
|
||||
func makeNSView(context: Context) -> NSVisualEffectView {
|
||||
|
||||
Reference in new issue
Block a user