From 6ffa5cf8339f37c0d8c5a684dbc773d8d9379b22 Mon Sep 17 00:00:00 2001 From: gambit1185_church Date: Mon, 1 Jun 2026 11:39:07 -0600 Subject: [PATCH] feat: use Liquid Glass effect on iOS/macOS 26+ On iOS 26 / macOS 26 and later, render the toast background with `.glassEffect(in:)` for a native Liquid Glass look. Earlier OS versions keep the existing solid-color / BlurView background. Fully gated behind `if #available(iOS 26, macOS 26, *)`. Based on lfuelling's elai950/AlertToast#112. Co-Authored-By: lfuelling Co-Authored-By: Claude Opus 4.8 (1M context) --- Sources/AlertToast/AlertToast.swift | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Sources/AlertToast/AlertToast.swift b/Sources/AlertToast/AlertToast.swift index 71d9e19..0362fc7 100644 --- a/Sources/AlertToast/AlertToast.swift +++ b/Sources/AlertToast/AlertToast.swift @@ -642,12 +642,23 @@ fileprivate struct BackgroundModifier: ViewModifier{ @ViewBuilder func body(content: Content) -> some View { - if let color = color { - content - .background(color) - }else{ - content - .background(BlurView()) + if #available(iOS 26, macOS 26, *) { + if let color = color { + content + .background(color) + .glassEffect(in: .rect(cornerRadius: 16)) + } else { + content + .glassEffect(in: .rect(cornerRadius: 16)) + } + } else { + if let color = color { + content + .background(color) + } else { + content + .background(BlurView()) + } } } }