@@ -70,23 +70,31 @@ 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- )
88- // Adds shadow for depth and elevation
89- . shadow ( color: shadowColor. opacity ( shadowOpacity) , radius: shadowRadius, x: shadowX, y: shadowY)
73+ if #available( iOS 26 . 0 , macOS 26 . 0 , watchOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * ) {
74+ content
75+ . background ( material)
76+ . glassEffect ( in: . rect( cornerRadius: radius) )
77+ . cornerRadius ( radius)
78+ . shadow ( color: shadowColor. opacity ( shadowOpacity) , radius: shadowRadius, x: shadowX, y: shadowY)
79+ } else {
80+ content
81+ . background ( material) // Use the specified material for the frosted glass base
82+ . cornerRadius ( radius) // Rounds the corners
83+ . overlay (
84+ // Adds subtle gradient border for dimensional effect
85+ RoundedRectangle ( cornerRadius: radius)
86+ . stroke (
87+ LinearGradient (
88+ gradient: Gradient ( colors: gradientColors ( ) ) ,
89+ startPoint: . topLeading,
90+ endPoint: . bottomTrailing
91+ ) ,
92+ lineWidth: strokeWidth
93+ )
94+ )
95+ // Adds shadow for depth and elevation
96+ . shadow ( color: shadowColor. opacity ( shadowOpacity) , radius: shadowRadius, x: shadowX, y: shadowY)
97+ }
9098 }
9199
92100 /// Generates the gradient colors based on the selected style
0 commit comments