File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,19 @@ private extension VisualEffectView {
237237 }
238238 }
239239
240+ /// Creates UIGlassEffect using runtime reflection to avoid compile-time SDK dependency
241+ func createGlassEffect( style: GlassStyle ) -> UIVisualEffect ? {
242+ // Check if UIGlassEffect exists at runtime (iOS 26+)
243+ guard let glassEffectClass = NSClassFromString ( " UIGlassEffect " ) as? NSObject . Type else {
244+ return nil
245+ }
246+
247+ // Create the effect using KVC to avoid compile-time type checking
248+ let glassEffect = glassEffectClass. init ( )
249+ glassEffect. setValue ( style. rawValue, forKey: " style " )
250+ return glassEffect as? UIVisualEffect
251+ }
252+
240253 func reapplyCustomSnapshot( ) {
241254 // Apply in a safe order; these call into the existing custom pipeline
242255 self . scale = customSnapshot. scale
You can’t perform that action at this time.
0 commit comments