Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update OS 26.0
  • Loading branch information
1998code committed Jun 10, 2025
commit 54f0f9a042cc23cf47f1e39eb74cebc37de51226
11 changes: 9 additions & 2 deletions Demo/Demo/Samples/_BlankTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ import SwiftGlass

struct BlankTemplate: View {
var body: some View {
VStack {
Text("Hello, Developer!")
ZStack {
bg
Text("Hello, Developer!")
.bold()
.padding(25)
.glass()
}
}

var bg: some View {
LinearGradient(colors: [Color.clear, Color.pink.opacity(0.85)], startPoint: .topLeading, endPoint: .bottomTrailing)
.ignoresSafeArea()
}
}

#Preview("Dark") {
Expand Down
37 changes: 21 additions & 16 deletions Sources/SwiftGlass/GlassBackgroundModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,28 @@ public struct GlassBackgroundModifier: ViewModifier {
/// 2. Gradient stroke for edge highlighting
/// 3. Shadow for depth perception
public func body(content: Content) -> some View {
content
.background(material) // Use the specified material for the frosted glass base
.cornerRadius(radius) // Rounds the corners
.overlay(
// Adds subtle gradient border for dimensional effect
RoundedRectangle(cornerRadius: radius)
.stroke(
LinearGradient(
gradient: Gradient(colors: gradientColors()),
startPoint: .topLeading,
endPoint: .bottomTrailing
),
lineWidth: strokeWidth
)
)
if #available(iOS 26.0, macOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0, *) {
Comment thread
1998code marked this conversation as resolved.
content
.glassEffect()
} else {
content
.background(material) // Use the specified material for the frosted glass base
.cornerRadius(radius) // Rounds the corners
.overlay(
// Adds subtle gradient border for dimensional effect
RoundedRectangle(cornerRadius: radius)
.stroke(
LinearGradient(
gradient: Gradient(colors: gradientColors()),
startPoint: .topLeading,
endPoint: .bottomTrailing
),
lineWidth: strokeWidth
)
)
// Adds shadow for depth and elevation
.shadow(color: shadowColor.opacity(shadowOpacity), radius: shadowRadius, x: shadowX, y: shadowY)
.shadow(color: shadowColor.opacity(shadowOpacity), radius: shadowRadius, x: shadowX, y: shadowY)
}
}

/// Generates the gradient colors based on the selected style
Expand Down