From 02ab04c69ee24ad79275f0dc0c9c596ae7d6daa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= <49094811+leonboe1@users.noreply.github.com> Date: Sun, 5 Apr 2026 11:24:08 +0200 Subject: [PATCH] Fix toast view liquid glass not updating background --- QuickDrop/View/Toast/QuickDropToastView.swift | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/QuickDrop/View/Toast/QuickDropToastView.swift b/QuickDrop/View/Toast/QuickDropToastView.swift index 8739ba1..5ec4c81 100644 --- a/QuickDrop/View/Toast/QuickDropToastView.swift +++ b/QuickDrop/View/Toast/QuickDropToastView.swift @@ -439,8 +439,7 @@ struct AdaptiveToastBackgroundLayer: View { var body: some View { Group { if #available(macOS 26.0, *) { - Color.clear - .glassEffect(.regular, in: .rect(cornerRadius: cornerRadius, style: .continuous)) + GlassEffectBackgroundView(cornerRadius: cornerRadius) } else { VisualEffectView(material: .hudWindow, blendingMode: .behindWindow, cornerRadius: cornerRadius) } @@ -449,6 +448,22 @@ struct AdaptiveToastBackgroundLayer: View { } +@available(macOS 26.0, *) +struct GlassEffectBackgroundView: NSViewRepresentable { + var cornerRadius: CGFloat = 0 + + func makeNSView(context: Context) -> NSGlassEffectView { + let v = NSGlassEffectView() + v.cornerRadius = cornerRadius + return v + } + + func updateNSView(_ v: NSGlassEffectView, context: Context) { + v.cornerRadius = cornerRadius + } +} + + // NSVisualEffectView wrapper for macOS 11 compatible blur/vibrancy struct VisualEffectView: NSViewRepresentable { var material: NSVisualEffectView.Material = .hudWindow