@@ -70,23 +70,28 @@ public struct GlassBackgroundModifier: ViewModifier {
7070 /// 2. Gradient stroke for edge highlighting
7171 /// 3. Shadow for depth perception
7272 public func body( content: Content ) -> some View {
73- content
74- . background ( material) // Use the specified material for the frosted glass base
75- . cornerRadius ( radius) // Rounds the corners
76- . overlay (
77- // Adds subtle gradient border for dimensional effect
78- RoundedRectangle ( cornerRadius: radius)
79- . stroke (
80- LinearGradient (
81- gradient: Gradient ( colors: gradientColors ( ) ) ,
82- startPoint: . topLeading,
83- endPoint: . bottomTrailing
84- ) ,
85- lineWidth: strokeWidth
86- )
87- )
73+ if #available( iOS 26 . 0 , macOS 26 . 0 , watchOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * ) {
74+ content
75+ . glassEffect ( )
76+ } else {
77+ content
78+ . background ( material) // Use the specified material for the frosted glass base
79+ . cornerRadius ( radius) // Rounds the corners
80+ . overlay (
81+ // Adds subtle gradient border for dimensional effect
82+ RoundedRectangle ( cornerRadius: radius)
83+ . stroke (
84+ LinearGradient (
85+ gradient: Gradient ( colors: gradientColors ( ) ) ,
86+ startPoint: . topLeading,
87+ endPoint: . bottomTrailing
88+ ) ,
89+ lineWidth: strokeWidth
90+ )
91+ )
8892 // Adds shadow for depth and elevation
89- . shadow ( color: shadowColor. opacity ( shadowOpacity) , radius: shadowRadius, x: shadowX, y: shadowY)
93+ . shadow ( color: shadowColor. opacity ( shadowOpacity) , radius: shadowRadius, x: shadowX, y: shadowY)
94+ }
9095 }
9196
9297 /// Generates the gradient colors based on the selected style
0 commit comments