- Published on
> Getting Started with Liquid Glass in SwiftUI
- Authors

- Name
- Mick MacCallum
- @0x7fs
iOS 26 brings the biggest visual redesign since iOS 7. At its heart is Liquid Glass, a translucent material that floats above your content with depth-aware surfaces that reflect and refract their surroundings. System apps use it everywhere, from tab bars to toolbars, and you can apply the same treatment to your own views with the glassEffect modifier.
Basic Usage
The simplest way to add glass styling is calling .glassEffect() with no parameters:
import SwiftUI
struct FloatingButton: View {
var body: some View {
Button("Continue") {
// action
}
.padding(.horizontal, 20)
.padding(.vertical, 12)
.glassEffect()
}
}
This applies the .regular glass variant with a capsule shape by default. The button now has a frosted, translucent appearance that adapts to whatever content sits behind it.
Glass Variants
SwiftUI provides three glass variants for different contexts:
// Standard translucent glass, adapts well to any background
.glassEffect(.regular)
// Higher transparency for media-rich backgrounds like photos or videos
.glassEffect(.clear)
// No effect - useful for conditionally disabling glass
.glassEffect(.identity)
The .regular variant works for most situations. Use .clear when your glass element floats over photo or video content where you want more of the background to show through. The .identity variant is handy for accessibility or when you need to toggle glass on and off.
Choosing a Shape
By default, glass uses a capsule shape, but you can specify other shapes as the second parameter:
// Circular glass for icon buttons
Image(systemName: "heart.fill")
.font(.title2)
.foregroundStyle(.white)
.frame(width: 50, height: 50)
.glassEffect(.regular, in: .circle)
// Rounded rectangle for larger surfaces
VStack {
Text("Now Playing")
.font(.headline)
Text("Artist - Song Title")
.font(.subheadline)
}
.padding()
.glassEffect(.regular, in: RoundedRectangle(cornerRadius: 16))
// Concentric corners that align with parent containers
Text("Nested Content")
.padding()
.glassEffect(.regular, in: .rect(cornerRadius: .containerConcentric))
The .containerConcentric corner radius is particularly useful when nesting glass elements, as it automatically calculates corner radii that align visually with parent containers.
Tinting Glass
Add semantic color to your glass elements using the tint method:
Button("Delete") {
// action
}
.padding()
.glassEffect(.regular.tint(.red))
Button("Confirm") {
// action
}
.padding()
.glassEffect(.regular.tint(.green.opacity(0.8)))
Tinting works well for conveying meaning, like destructive actions in red or confirmations in green. You can adjust opacity on the tint color for subtler effects.
When to Use Glass
Apple's design guidance is clear: Liquid Glass belongs on the navigation layer, not on your main content. Think of it as floating chrome that sits above your app's primary UI.
Good candidates for glass styling include floating action buttons, custom toolbars or tab bars, overlay controls like media playback, and modal sheet headers. Elements that live within your content flow, like list rows or cards, generally shouldn't use glass. The effect works best when there's actual content behind it to refract.
A Complete Example
Here's a floating action button that demonstrates glass in context:
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack(alignment: .bottomTrailing) {
ScrollView {
LazyVStack(spacing: 16) {
ForEach(0..<20) { index in
RoundedRectangle(cornerRadius: 12)
.fill(.blue.gradient)
.frame(height: 100)
.overlay {
Text("Item \(index)")
.foregroundStyle(.white)
}
}
}
.padding()
}
Button {
// compose action
} label: {
Image(systemName: "plus")
.font(.title2)
.fontWeight(.semibold)
.foregroundStyle(.white)
.frame(width: 56, height: 56)
}
.glassEffect(.regular.tint(.blue), in: .circle)
.padding()
}
}
}
As you scroll, the floating button's glass surface refracts the content passing behind it, creating that signature Liquid Glass depth effect.
Accessibility
The system handles accessibility automatically. When users enable Reduce Transparency, glass elements get increased frosting. With Increase Contrast enabled, you'll see starker colors and borders. Reduce Motion tones down the animations. Starting in iOS 26.1, users can also control glass opacity directly in Settings.
You generally don't need to write any code to support these preferences, but if you do need to conditionally disable glass, check the accessibilityReduceTransparency environment value:
@Environment(\.accessibilityReduceTransparency) private var reduceTransparency
var body: some View {
Button("Action") { }
.padding()
.glassEffect(reduceTransparency ? .identity : .regular)
}
For most apps, letting the system handle this automatically is the right choice.
Liquid Glass is just the beginning. Once you're comfortable with the basics, you can group multiple glass elements together using GlassEffectContainer for coordinated blending, or use glassEffectID to create smooth morphing transitions between glass views.
// Continue_Learning
Building Interactive Glass Controls in SwiftUI
Make your glass elements respond to touch with scaling, shimmer effects, and touch-point illumination using the interactive() modifier and glass button styles.
Coordinating Glass Elements with GlassEffectContainer
When you have multiple glass elements that should blend and animate together, GlassEffectContainer coordinates their rendering for seamless visual results.
Creating Morphing Glass Transitions with glassEffectID
The glassEffectID modifier enables glass views to smoothly morph into one another during state changes, creating fluid transitions that feel native to iOS 26.
// Stay Updated
Get notified when I publish new tutorials on Swift, SwiftUI, and iOS development. No spam, unsubscribe anytime.