SwiftUI Liquid Glass
Liquid Glass is the dynamic translucent material introduced across Apple platforms 26. Standard SwiftUI bars and presentations adopt it automatically when built with the current SDK. Reserve custom glass for functional controls and navigation surfaces, not general content backgrounds.
See references/liquid-glass.md [blocked] for the full API reference with additional examples.
Contents
Workflow
Choose the path that matches the request:
1. Implement a new feature with Liquid Glass
- Identify target surfaces (floating controls, custom bars, transient controls).
- Decide shape, prominence, and whether each element is a real control or static status.
- Wrap grouped glass elements in a
GlassEffectContainer. - Apply
.glassEffect()after layout and appearance modifiers. - Add
.interactive()only to tappable/focusable elements. - Add morphing transitions with
glassEffectID(_:in:)where the view hierarchy changes with animation. PutglassEffectTransition(_:)on the inserted or removed glass child, not on the always-present container, and choose the style using Morphing & Transitions. - Gate with
if #available(iOS 26, *)and provide a fallback for earlier versions.
2. Improve an existing feature with Liquid Glass
- Find custom control or navigation backgrounds that can be replaced with
.glassEffect(). - Wrap sibling glass elements in
GlassEffectContainerfor blending and performance. - Replace custom glass-like buttons with
.buttonStyle(.glass),.buttonStyle(.glassProminent), or configurable styles such as.buttonStyle(.glass(.clear)). Use.glass(_:)when the button needs a specific tint or variant; reserve.glassProminentfor high-emphasis primary actions. - Add morphing transitions where animated insertion/removal occurs.
3. Review existing Liquid Glass usage
Trace each effect through content/control ownership, layout order, container scope, interactivity, transitions, availability, accessibility settings, and fallback. Restore the same UI fixture and rerun the checklist after each correction.
Core API Summary
glassEffect(_:in:)
Applies Liquid Glass behind a view. Default: .regular variant in a Capsule shape.
Glass struct
Chain them: .regular.tint(.blue).interactive()
GlassEffectContainer
Wraps multiple glass views for shared rendering, blending, and morphing.
The spacing controls when nearby glass shapes begin to blend. Match or exceed
the interior layout spacing so shapes merge during animated transitions but remain
separate at rest.
Morphing & Transitions
Transition decision: use .matchedGeometry for nearby effects inside the container's
spacing; use .materialize for distant insertion/removal or when no geometry match
should occur; use .identity only when no transition animation is wanted.
Button Styles
Related iOS 26 APIs
See the corresponding sections in references/liquid-glass.md [blocked] for signatures and examples.
Code Examples
Glass button with availability gate
Grouped glass shapes in a container
Nearby morphing transition
Unioning views into a single glass shape
Tinted glass icon control
Clear glass action over bright content
Use clear glass only when the background still leaves labels and symbols readable. On bright or busy backgrounds, add a subtle dimming layer or choose a more opaque button style.
Static status count, not a toolbar control
Common Mistakes
Review Checklist
- Availability:
if #available(iOS 26, *)present with fallback UI. - Container: Multiple glass views wrapped in
GlassEffectContainer. - Modifier order:
.glassEffect()applied after layout/appearance modifiers. - Interactivity:
.interactive()used only where user interaction exists. - Status vs action: Static counts/status are not toolbar controls and do not expose press/hover affordance.
- Transitions:
glassEffectIDused with@Namespacefor morphing animations. - Transition type:
.matchedGeometryfor nearby effects;.materializefor distant ones, applied to the conditional glass child. - Consistency: Shapes, tints, and spacing are uniform across related elements.
- Performance: Glass effects are limited in number; container used for grouping.
- Accessibility: Tested with Reduce Transparency and Reduce Motion enabled.
- Button styles: Standard
.glass,.glassProminent, or configurable.glass(_:)used for buttons;.glass(_:)is primary when a tint or clear variant is required. - Clear glass contrast: Clear glass over bright content has a dimming/contrast treatment or uses a more legible style.
- Concurrency: IDs passed to
glassEffectID/glassEffectUnionareSendable; MainActor-annotated Liquid Glass APIs stay in SwiftUI UI code.
References
- Full API guide: references/liquid-glass.md [blocked]
- Apple docs: Applying Liquid Glass to custom views
- Apple docs: Adopting Liquid Glass


