SwiftUI Liquid Glass Design Protocol (iOS 26+)
This skill provides the required guidelines and implementation patterns for applying the Liquid Glass design language in SwiftUI. It ensures that UI components use appropriate transparency, blending, structural elements, and interactive lighting using the native iOS 26+ APIs.
Core Principles
For iOS 26 and later, Apple provides a native API for Liquid Glass that combines optical glass properties with fluidity.
- Native API Priority: Use
.glassEffect(...)as the primary modifier for all glass surfaces. - Container Usage: Wrap multiple co-existing glass elements in a
GlassEffectContainer(spacing: ...). This manages how the glass surfaces merge and blend. - Modifier Order: Always apply
.glassEffect()after layout (padding, frame) and appearance modifiers. - Interactivity: Append
.interactive()to the effect (e.g.,.glassEffect(.regular.interactive())) for elements that respond to touch or pointer input. - Shape Definition: Specify shapes directly within the effect:
.glassEffect(..., in: .rect(cornerRadius: 20)). Supported shapes include.capsule,.circle, and.rect. - Morphing & Grouping:
- Use
.glassEffectID(id, in: namespace)with@Namespacefor fluid morphing transitions between view states. - Use
.glassEffectUnion(id: "group", namespace: namespace)to visually unite adjacent glass elements within a container.
- Use
Implementation Guidelines
Native Implementation Patterns
// 1. Group multiple glass views to manage blending
GlassEffectContainer(spacing: 24) {
HStack(spacing: 24) {
// 2. Apply interactive glass effect with shape
Image(systemName: "scribble.variable")
.padding()
.glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
// 3. Tinted non-interactive glass
Text("Status Label")
.padding()
.glassEffect(.regular.tint(.blue), in: .capsule)
}
}
Component References
👉 Read references/controls-and-navigation.md for concrete examples of Liquid Glass controls and morphing transitions.
👉 Read references/component-best-practices.md for detailed best practices and usage guidelines for specific components.
Checklist for Reviewing Views
When instructed to apply Liquid Glass or review an existing view:
- Composition: Multiple glass views are wrapped in
GlassEffectContainerwith appropriate spacing. - Modifier Order:
.glassEffect()is applied after layout/appearance modifiers. - Interactivity:
.interactive()is used only where user interaction exists (e.g., buttons, draggable items). - Transitions:
glassEffectIDis used with@Namespacefor morphing between states. - Union:
.glassEffectUnionis used to visually merge related adjacent glass elements within a container. - Consistency: Shapes, tinting, and spacing align across the feature.
- Native Components: Verify that
.buttonStyle(.glass)or.buttonStyle(.glassProminent)is used for standard actions.