SwiftUI Liquid Glass
Overview
Use this skill to build or review SwiftUI features that fully align with the iOS 26+ Liquid Glass API. Prioritize native APIs (glassEffect, GlassEffectContainer, glass button styles) and Apple design guidance. Keep usage consistent, interactive where needed, and performance aware.
Workflow Decision Tree
Choose the path that matches the request:
1) Review an existing feature
- Inspect where Liquid Glass should be used and where it should not.
- Verify correct modifier order, shape usage, and container placement.
- Check for iOS 26+ availability handling and sensible fallbacks.
2) Improve a feature using Liquid Glass
- Identify target components for glass treatment (surfaces, chips, buttons, cards).
- Refactor to use
GlassEffectContainer where multiple glass elements appear.
- Introduce interactive glass only for tappable or focusable elements.
3) Implement a new feature using Liquid Glass
- Design the glass surfaces and interactions first (shape, prominence, grouping).
- Add glass modifiers after layout/appearance modifiers.
- Add morphing transitions only when the view hierarchy changes with animation.
Core Guidelines
- Prefer native Liquid Glass APIs over custom blurs.
- Use
GlassEffectContainer when multiple glass elements coexist.
- Apply
.glassEffect(...) after layout and visual modifiers.
- Use
.interactive() for elements that respond to touch/pointer.
- Keep shapes consistent across related elements for a cohesive look.
- Gate with
#available(iOS 26, *) and provide a non-glass fallback.
Review Checklist
- Availability:
#available(iOS 26, *) present with fallback UI.
- Composition: Multiple glass views wrapped in
GlassEffectContainer.
- Modifier order:
glassEffect applied after layout/appearance modifiers.
- Interactivity:
interactive() only where user interaction exists.
- Transitions:
glassEffectID used with @Namespace for morphing.
- Consistency: Shapes, tinting, and spacing align across the feature.
Implementation Checklist
- Define target elements and desired glass prominence.
- Wrap grouped glass elements in
GlassEffectContainer and tune spacing.
- Use
.glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...)) as needed.
- Use
.buttonStyle(.glass) / .buttonStyle(.glassProminent) for actions.
- Add morphing transitions with
glassEffectID when hierarchy changes.
- Provide fallback materials and visuals for earlier iOS versions.
Quick Snippets
Use these patterns directly and tailor shapes/tints/spacing.
if #available(iOS 26, *) {
Text("Hello")
.padding()
.glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
Text("Hello")
.padding()
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}
GlassEffectContainer(spacing: 24) {
HStack(spacing: 24) {
Image(systemName: "scribble.variable")
.frame(width: 72, height: 72)
.font(.system(size: 32))
.glassEffect()
Image(systemName: "eraser.fill")
.frame(width: 72, height: 72)
.font(.system(size: 32))
.glassEffect()
}
}
Button("Confirm") { }
.buttonStyle(.glassProminent)
Resources
- Reference guide:
references/liquid-glass.md
- Prefer Apple docs for up-to-date API details.
1---
2name: swiftui-liquid-glass
3description: >-
4 Implement iOS 26+ Liquid Glass design in SwiftUI. Use when: adopting Liquid Glass API, refactoring existing UI to Liquid Glass, or reviewing Liquid Glass usage.
5license: MIT
6compatibility: "iOS 26+ / macOS 26+ with SwiftUI"
7metadata:
8 author: terminal-skills
9 version: "1.0.0"
10 category: development
11 tags: [swiftui, liquid-glass, wwdc, design, ios]
12 use-cases:
13 - "Adopt Liquid Glass in new SwiftUI features"
14 - "Refactor existing UI to use Liquid Glass patterns"
15 agents: [claude-code, openai-codex, gemini-cli, cursor]
16---
17
18# SwiftUI Liquid Glass
19
20## Overview
21Use this skill to build or review SwiftUI features that fully align with the iOS 26+ Liquid Glass API. Prioritize native APIs (`glassEffect`, `GlassEffectContainer`, glass button styles) and Apple design guidance. Keep usage consistent, interactive where needed, and performance aware.
22
23## Workflow Decision Tree
24Choose the path that matches the request:
25
26### 1) Review an existing feature
27- Inspect where Liquid Glass should be used and where it should not.
28- Verify correct modifier order, shape usage, and container placement.
29- Check for iOS 26+ availability handling and sensible fallbacks.
30
31### 2) Improve a feature using Liquid Glass
32- Identify target components for glass treatment (surfaces, chips, buttons, cards).
33- Refactor to use `GlassEffectContainer` where multiple glass elements appear.
34- Introduce interactive glass only for tappable or focusable elements.
35
36### 3) Implement a new feature using Liquid Glass
37- Design the glass surfaces and interactions first (shape, prominence, grouping).
38- Add glass modifiers after layout/appearance modifiers.
39- Add morphing transitions only when the view hierarchy changes with animation.
40
41## Core Guidelines
42- Prefer native Liquid Glass APIs over custom blurs.
43- Use `GlassEffectContainer` when multiple glass elements coexist.
44- Apply `.glassEffect(...)` after layout and visual modifiers.
45- Use `.interactive()` for elements that respond to touch/pointer.
46- Keep shapes consistent across related elements for a cohesive look.
47- Gate with `#available(iOS 26, *)` and provide a non-glass fallback.
48
49## Review Checklist
50- **Availability**: `#available(iOS 26, *)` present with fallback UI.
51- **Composition**: Multiple glass views wrapped in `GlassEffectContainer`.
52- **Modifier order**: `glassEffect` applied after layout/appearance modifiers.
53- **Interactivity**: `interactive()` only where user interaction exists.
54- **Transitions**: `glassEffectID` used with `@Namespace` for morphing.
55- **Consistency**: Shapes, tinting, and spacing align across the feature.
56
57## Implementation Checklist
58- Define target elements and desired glass prominence.
59- Wrap grouped glass elements in `GlassEffectContainer` and tune spacing.
60- Use `.glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...))` as needed.
61- Use `.buttonStyle(.glass)` / `.buttonStyle(.glassProminent)` for actions.
62- Add morphing transitions with `glassEffectID` when hierarchy changes.
63- Provide fallback materials and visuals for earlier iOS versions.
64
65## Quick Snippets
66Use these patterns directly and tailor shapes/tints/spacing.
67
68```swift
69if #available(iOS 26, *) {
70 Text("Hello")
71 .padding()
72 .glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
73} else {
74 Text("Hello")
75 .padding()
76 .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
77}
78```
79
80```swift
81GlassEffectContainer(spacing: 24) {
82 HStack(spacing: 24) {
83 Image(systemName: "scribble.variable")
84 .frame(width: 72, height: 72)
85 .font(.system(size: 32))
86 .glassEffect()
87 Image(systemName: "eraser.fill")
88 .frame(width: 72, height: 72)
89 .font(.system(size: 32))
90 .glassEffect()
91 }
92}
93```
94
95```swift
96Button("Confirm") { }
97 .buttonStyle(.glassProminent)
98```
99
100## Resources
101- Reference guide: `references/liquid-glass.md`
102- Prefer Apple docs for up-to-date API details.