@@ -32,6 +32,7 @@ class Toast: UIView, ThemeApplicable, Notifiable {
3232 weak var viewController : UIViewController ?
3333
3434 var dismissed = false
35+ private var glassEffectView : UIVisualEffectView ?
3536
3637 lazy var gestureRecognizer : UITapGestureRecognizer = {
3738 let gestureRecognizer = UITapGestureRecognizer ( target: self , action: #selector( handleTap) )
@@ -62,10 +63,12 @@ class Toast: UIView, ThemeApplicable, Notifiable {
6263
6364 override func layoutSubviews( ) {
6465 super. layoutSubviews ( )
65- layer. shadowPath = UIBezierPath (
66- roundedRect: self . toastView. bounds,
67- cornerRadius: UX . toastCornerRadius
68- ) . cgPath
66+ if #unavailable( iOS 26 . 0 ) {
67+ layer. shadowPath = UIBezierPath (
68+ roundedRect: self . toastView. bounds,
69+ cornerRadius: UX . toastCornerRadius
70+ ) . cgPath
71+ }
6972 }
7073
7174 func showToast( viewController: UIViewController ? = nil ,
@@ -125,8 +128,44 @@ class Toast: UIView, ThemeApplicable, Notifiable {
125128 }
126129
127130 func applyTheme( theme: Theme ) {
128- toastView. backgroundColor = theme. colors. actionPrimary
129- setupShadow ( theme: theme)
131+ if #available( iOS 26 . 0 , * ) {
132+ setupGlassEffect ( theme: theme)
133+ } else {
134+ toastView. backgroundColor = theme. colors. actionPrimary
135+ setupShadow ( theme: theme)
136+ }
137+ }
138+
139+ @available ( iOS 26 . 0 , * )
140+ private func setupGlassEffect( theme: Theme ) {
141+ // Only add glass effect if it doesn't already exist
142+ guard glassEffectView == nil else { return }
143+
144+ let effectView = UIVisualEffectView ( )
145+
146+ #if canImport(FoundationModels)
147+ let glassEffect = UIGlassEffect ( )
148+ glassEffect. tintColor = theme. colors. actionPrimary
149+ effectView. effect = glassEffect
150+ #else
151+ effectView. effect = UIBlurEffect ( style: . systemUltraThinMaterial)
152+ #endif
153+
154+ effectView. layer. cornerRadius = UX . toastCornerRadius
155+ effectView. clipsToBounds = true
156+ effectView. translatesAutoresizingMaskIntoConstraints = false
157+
158+ toastView. layer. masksToBounds = true
159+ toastView. insertSubview ( effectView, at: 0 )
160+
161+ NSLayoutConstraint . activate ( [
162+ effectView. topAnchor. constraint ( equalTo: toastView. topAnchor) ,
163+ effectView. leadingAnchor. constraint ( equalTo: toastView. leadingAnchor) ,
164+ effectView. trailingAnchor. constraint ( equalTo: toastView. trailingAnchor) ,
165+ effectView. bottomAnchor. constraint ( equalTo: toastView. bottomAnchor)
166+ ] )
167+
168+ glassEffectView = effectView
130169 }
131170
132171 private func setupShadow( theme: Theme ) {
0 commit comments