From aa9e1730bdc4755b84d70b2ff99a87e4d649aef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20F=C3=BClling?= Date: Thu, 19 Jun 2025 11:19:38 +0200 Subject: [PATCH] add liquid glass effect for iOS/macOS >= 26 --- Sources/AlertToast/AlertToast.swift | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Sources/AlertToast/AlertToast.swift b/Sources/AlertToast/AlertToast.swift index 17bf751..cf5271f 100644 --- a/Sources/AlertToast/AlertToast.swift +++ b/Sources/AlertToast/AlertToast.swift @@ -631,12 +631,22 @@ fileprivate struct BackgroundModifier: ViewModifier{ @ViewBuilder func body(content: Content) -> some View { - if let color = color { - content - .background(color) + 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{ - content - .background(BlurView()) + if let color = color { + content + .background(color) + }else{ + content + .background(BlurView()) + } } } }