axiom-liquid-glass

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Liquid Glass — Apple's New Material Design System

Liquid Glass — Apple全新材质设计系统

When to Use This Skill

何时使用此技能

Use when:
  • Implementing Liquid Glass effects in your app
  • Reviewing existing UI for Liquid Glass adoption opportunities
  • Debugging visual artifacts with Liquid Glass materials
  • Optimizing Liquid Glass performance
  • Requesting expert review of Liquid Glass implementation
  • Understanding when to use Regular vs Clear variants
  • Troubleshooting tinting, legibility, or adaptive behavior issues
适用于以下场景:
  • 在应用中实现Liquid Glass效果
  • 审查现有UI以寻找采用Liquid Glass的机会
  • 调试Liquid Glass材质的视觉瑕疵
  • 优化Liquid Glass的性能
  • 请求对Liquid Glass实现进行专家评审
  • 了解何时使用Regular与Clear变体
  • 排查着色、可读性或自适应行为问题

Related Skills

相关技能

  • Use
    axiom-liquid-glass-ref
    for comprehensive app-wide adoption guidance (app icons, controls, navigation, menus, windows, platform considerations)
  • 使用
    axiom-liquid-glass-ref
    获取全面的全应用采用指南(应用图标、控件、导航、菜单、窗口、平台考量)

Example Prompts

示例提示

These are real questions developers ask that this skill is designed to answer:
以下是开发者实际会提出的、本技能可解答的问题:

1. "I just saw Liquid Glass in WWDC videos. How is it different from blur effects I've used before? Should I adopt it?"

1. "我刚在WWDC视频里看到Liquid Glass,它和我之前用的模糊效果有什么不同?我应该采用它吗?"

→ The skill explains Liquid Glass as a lensing-based material (not blur), shows design philosophy, and when adoption makes sense
→ 本技能会解释Liquid Glass是基于透镜的材质(而非模糊),展示其设计理念,以及何时适合采用

2. "I'm implementing Liquid Glass in my app but the lensing effect doesn't look quite right. It looks like a regular blur. What am I missing?"

2. "我正在应用中实现Liquid Glass,但透镜效果看起来不太对,就像普通的模糊。我漏掉了什么?"

→ The skill covers the visual properties (lensing vs motion vs environment), Regular vs Clear variants, and debugging visual artifacts
→ 本技能会涵盖视觉属性(透镜效果 vs 动效 vs 环境)、Regular与Clear变体,以及视觉瑕疵的调试方法

3. "Liquid Glass works great on iPhone but looks odd on iPad. Should I adjust the implementation differently for different screen sizes?"

3. "Liquid Glass在iPhone上表现很好,但在iPad上看起来很奇怪。我需要针对不同屏幕尺寸调整实现方式吗?"

→ The skill demonstrates adaptive Liquid Glass patterns and platform-specific guidance (iOS 26+, macOS Tahoe+, axiom-visionOS 3+)
→ 本技能会展示Liquid Glass的自适应模式和平台特定指南(iOS 26+、macOS Tahoe+、axiom-visionOS 3+)

4. "I need to use Liquid Glass but still need legible text on top. How do I ensure text contrast while using Liquid Glass?"

4. "我需要使用Liquid Glass,但仍要保证上方文本的可读性。如何在使用Liquid Glass的同时确保文本对比度?"

→ The skill covers tinting strategies, adaptive color choices, and opacity patterns for maintaining readability across light/dark modes
→ 本技能会涵盖着色策略、自适应颜色选择,以及在明暗模式下保持可读性的透明度模式

5. "We want to do a design review of our Liquid Glass implementation. What are the expert criteria for a good Liquid Glass implementation?"

5. "我们想对Liquid Glass的实现进行设计评审。优秀的Liquid Glass实现有哪些专家评审标准?"

→ The skill provides the comprehensive review checklist and professional push-back frameworks for design review meetings

→ 本技能会提供全面的评审清单和设计评审会议的专业异议反馈框架

What is Liquid Glass?

什么是Liquid Glass?

Liquid Glass is Apple's next-generation material design system introduced at WWDC 2025. It represents a significant evolution from previous materials (Aqua, iOS 7 blurs, Dynamic Island) by creating a new digital meta-material that:
  • Dynamically bends and shapes light (lensing) rather than scattering it
  • Moves organically like a lightweight liquid, responding to touch and app dynamism
  • Adapts automatically to size, environment, content, and light/dark modes
  • Unifies design language across all Apple platforms (iOS, iPadOS, macOS, axiom-visionOS)
Core Philosophy: Liquid Glass complements the evolution of rounded, immersive screens with rounded, floating forms that feel natural to touch interaction while letting content shine through.

Liquid Glass是Apple在WWDC 2025上推出的下一代材质设计系统。它代表了与之前材质(Aqua、iOS 7模糊效果、灵动岛)的重大演进,创建了一种全新的数字元材质,具备以下特性:
  • 动态弯曲和塑形光线(透镜效果)而非散射光线
  • 像轻质液体一样有机移动,响应触摸和应用动态变化
  • 自动适配尺寸、环境、内容以及明暗模式
  • 统一所有Apple平台的设计语言(iOS、iPadOS、macOS、axiom-visionOS)
核心理念:Liquid Glass通过圆润、悬浮的形态,补充了圆润沉浸式屏幕的演进,让触摸交互感觉自然,同时突出内容本身。

Visual Properties

视觉属性

1. Lensing (Primary Visual Characteristic)

1. 透镜效果(核心视觉特征)

Liquid Glass defines itself through lensing — the warping and bending of light that communicates presence, motion, and form.
How it works:
  • Dynamically concentrates and shapes light in real-time
  • Provides definition against background while feeling visually grounded
  • Controls feel ultra-lightweight and transparent while visually distinguishable
  • Elements materialize in/out by modulating light bending (not fading)
Design Implication: Unlike previous materials that scattered light, Liquid Glass uses instinctive visual cues from the natural world to provide separation.
Liquid Glass通过透镜效果定义自身——光线的扭曲和弯曲传达存在感、动态感和形态。
工作原理
  • 实时动态聚集和塑形光线
  • 在背景之上提供清晰轮廓,同时视觉上感觉贴合
  • 控件感觉超轻量且透明,同时视觉上可区分
  • 元素通过调节光线弯曲(而非淡入淡出)实现显现/消失
设计意义:与之前散射光线的材质不同,Liquid Glass使用自然界的直观视觉线索来实现元素分离。

2. Motion & Fluidity

2. 动效与流畅性

Motion and visuals were designed as one unified experience:
  • Instant flex and energize — Responds to interaction by flexing with light
  • Gel-like flexibility — Communicates transient, malleable nature
  • Moves in tandem with interaction — Aligns with dynamism of thinking and movement
  • Temporary lift — Elements can lift into Liquid Glass on interaction (great for controls)
  • Dynamic morphing — Continuously shape-shifts between app states as a singular floating plane
  • Lightweight transitions — Menus pop open in-line, maintaining clear relationship to source
动效与视觉设计被整合为统一的体验:
  • 即时弯曲与激活——通过光线弯曲响应用户交互
  • 凝胶般的柔韧性——传达短暂、可塑的特性
  • 与交互同步移动——与思维和动作的动态性保持一致
  • 临时抬起——元素可在交互时转换为Liquid Glass效果(非常适合控件)
  • 动态变形——作为单一悬浮平面,在应用状态间持续变形
  • 轻量过渡——菜单内联弹出,与来源保持清晰关联

3. Adaptive Behavior

3. 自适应行为

Liquid Glass continuously adapts without fixed light/dark appearance:
Content-aware adaptation:
  • Shadows become more prominent when text scrolls underneath
  • Tint and dynamic range shift to ensure legibility
  • Independently switches light/dark to feel at home in any context
  • Larger elements (menus, sidebars) simulate thicker material with deeper shadows and richer lensing
Platform adaptation:
  • Nests perfectly into rounded corners of windows
  • Forms distinct functional layer for controls/navigation
  • Ambient environment (colorful content nearby) subtly spills onto surface
  • Light reflects, scatters, and bleeds into shadows

Liquid Glass持续自适应,没有固定的明暗外观:
内容感知自适应
  • 当文本在下方滚动时,阴影会变得更明显
  • 着色和动态范围会调整以确保可读性
  • 独立切换明暗模式,以适配任何场景
  • 较大元素(菜单、侧边栏)模拟更厚的材质,带有更深的阴影和更丰富的透镜效果
平台自适应
  • 完美适配窗口的圆角
  • 为控件/导航形成独特的功能层
  • 周围环境(附近的彩色内容)会微妙地融入表面
  • 光线会反射、散射并渗透到阴影中

Implementation Guide

实现指南

Basic API Usage

基础API使用

SwiftUI:
glassEffect
Modifier

SwiftUI:
glassEffect
修饰符

swift
// Basic usage - applies glass within capsule shape
Text("Hello")
    .glassEffect()

// Custom shape
Text("Hello")
    .glassEffect(in: RoundedRectangle(cornerRadius: 12))

// Interactive elements (iOS - for controls/containers)
Button("Tap Me") {
    // action
}
.glassEffect()
.interactive() // Add for custom controls on iOS
Automatic Adoption: Simply recompiling with Xcode 26 brings Liquid Glass to standard controls automatically.
swift
// 基础用法 - 在胶囊形状内应用玻璃效果
Text("Hello")
    .glassEffect()

// 自定义形状
Text("Hello")
    .glassEffect(in: RoundedRectangle(cornerRadius: 12))

// 交互元素(iOS - 适用于控件/容器)
Button("Tap Me") {
    // 动作
}
.glassEffect()
.interactive() // 为iOS上的自定义控件添加此修饰符
自动采用:只需使用Xcode 26重新编译,标准控件就会自动应用Liquid Glass效果。

Variants: Regular vs Clear

变体:Regular vs Clear

CRITICAL DECISION: Never mix Regular and Clear in the same interface.
关键决策:切勿在同一界面中混合使用Regular和Clear变体。

Regular Variant (Default — Use Most Often)

Regular变体(默认 - 最常用)

Characteristics:
  • Most versatile, use in 95% of cases
  • Full visual and adaptive effects
  • Provides legibility regardless of context
  • Works in any size, over any content
  • Anything can be placed on top
When to use: Navigation bars, tab bars, toolbars, buttons, menus, sidebars
swift
// Regular is the default
NavigationView {
    // Content
}
.glassEffect() // Uses Regular variant
特性
  • 用途最广泛,95%的场景都适用
  • 具备完整的视觉和自适应效果
  • 在任何场景下都能保证可读性
  • 适用于任何尺寸、任何内容之上
  • 可在其上方放置任何元素
适用场景:导航栏、标签栏、工具栏、按钮、菜单、侧边栏
swift
// Regular是默认变体
NavigationView {
    // 内容
}
.glassEffect() // 使用Regular变体

Clear Variant (Special Cases Only)

Clear变体(仅特殊场景使用)

Characteristics:
  • Permanently more transparent
  • No adaptive behaviors
  • Allows content richness to interact with glass
  • Requires dimming layer for legibility
Use ONLY when ALL three conditions are met:
  1. ✅ Element is over media-rich content
  2. ✅ Content layer won't be negatively affected by dimming layer
  3. ✅ Content above glass is bold and bright
swift
// Clear variant with localized dimming for small footprints
ZStack {
    MediaRichBackground()
        .overlay(.black.opacity(0.3)) // Dimming layer

    BoldBrightControl()
        .glassEffect(.clear)
}
⚠️ WARNING: Using Clear without meeting all three conditions results in poor legibility.

特性
  • 永久保持更高的透明度
  • 无自适应行为
  • 允许内容的丰富细节与玻璃效果交互
  • 需要调暗层以保证可读性
仅在同时满足以下三个条件时使用
  1. ✅ 元素位于媒体丰富的内容之上
  2. ✅ 调暗层不会对内容层产生负面影响
  3. ✅ 玻璃上方的内容醒目且明亮
swift
// 针对小区域使用带局部调暗的Clear变体
ZStack {
    MediaRichBackground()
        .overlay(.black.opacity(0.3)) // 调暗层

    BoldBrightControl()
        .glassEffect(.clear)
}
⚠️ 警告:如果不满足所有三个条件就使用Clear变体,会导致可读性极差。

Layered System Architecture

分层系统架构

Liquid Glass is composed of multiple layers working together:
Liquid Glass由多个协同工作的层组成:

1. Highlights Layer

1. 高光层

  • Light sources shine on material, producing highlights responding to geometry
  • Lights move during interactions (lock/unlock), defining silhouette
  • Some cases respond to device motion (feels aware of position in real world)
  • 光源照射在材质上,产生响应几何形状的高光
  • 在交互过程中(锁定/解锁),光源会移动,定义元素轮廓
  • 在某些场景下会响应设备运动(感觉能感知真实世界中的位置)

2. Shadows Layer

2. 阴影层

  • Aware of background content
  • Increases shadow opacity over text for separation
  • Lowers shadow opacity over solid light backgrounds
  • Ensures elements are always easy to spot
  • 感知背景内容
  • 在文本上方时增加阴影透明度以实现分离
  • 在纯色明亮背景上降低阴影透明度
  • 确保元素始终易于识别

3. Internal Glow (Interaction Feedback)

3. 内部发光(交互反馈)

  • Material illuminates from within on interaction
  • Glow starts under fingertips, spreads throughout element
  • Spreads to nearby Liquid Glass elements
  • Interacts with flexible properties - feels natural and fluid
  • Makes interface feel alive and connected to physical world
  • 交互时材质从内部发光
  • 发光从指尖下方开始,扩散到整个元素
  • 扩散到附近的Liquid Glass元素
  • 与柔韧性特性交互——感觉自然流畅
  • 让界面感觉生动,与物理世界相连

4. Adaptive Tinting Layer

4. 自适应着色层

  • Multiple layers adapt together to maintain hierarchy
  • Windows losing focus visually recede (Mac/iPad)
  • All behaviors come built-in automatically

  • 多个层协同自适应以保持层级结构
  • 失去焦点的窗口会在视觉上后退(Mac/iPad)
  • 所有行为都内置自动实现

Design Principles & Best Practices

设计原则与最佳实践

✅ DO: Reserve for Navigation Layer

✅ 建议:仅用于导航层

Correct Usage:
[Content Layer — No Glass]
[Navigation Layer — Liquid Glass]
    • Tab bars
    • Navigation bars
    • Toolbars
    • Floating controls
Why: Liquid Glass floats above content, creating clear hierarchy.
正确用法
[内容层 — 无玻璃效果]
[导航层 — Liquid Glass]
    • 标签栏
    • 导航栏
    • 工具栏
    • 悬浮控件
原因:Liquid Glass悬浮在内容之上,创建清晰的层级结构。

❌ DON'T: Use on Content Layer

❌ 禁止:在内容层使用

Wrong:
swift
// DON'T apply to table views, lists, or content
List(items) { item in
    Text(item.name)
}
.glassEffect() // ❌ Competes with navigation, muddy hierarchy
Why: Makes elements compete, creates visual confusion.
错误示例
swift
// 禁止应用于表格视图、列表或内容
List(items) { item in
    Text(item.name)
}
.glassEffect() // ❌ 与导航层冲突,模糊层级结构
原因:会导致元素竞争,造成视觉混淆。

❌ DON'T: Stack Glass on Glass

❌ 禁止:玻璃效果叠加

Wrong:
swift
ZStack {
    NavigationBar()
        .glassEffect() // ❌

    FloatingButton()
        .glassEffect() // ❌ Glass on glass
}
Correct:
swift
ZStack {
    NavigationBar()
        .glassEffect()

    FloatingButton()
        .foregroundStyle(.primary) // Use fills, transparency, vibrancy
        // Feels like thin overlay part of the material
}
错误示例
swift
ZStack {
    NavigationBar()
        .glassEffect() // ❌

    FloatingButton()
        .glassEffect() // ❌ 玻璃效果叠加
}
正确示例
swift
ZStack {
    NavigationBar()
        .glassEffect()

    FloatingButton()
        .foregroundStyle(.primary) // 使用填充、透明度、活力效果
        // 感觉像是材质的薄覆盖层
}

✅ DO: Avoid Content Intersections in Steady State

✅ 建议:在稳定状态下避免内容交叉

Wrong: Content intersects with Liquid Glass when app launches
Correct: Reposition or scale content to maintain separation in steady states
Why: Prevents unwanted visual noise; intersections acceptable during scrolling/transitions.

错误:应用启动时内容与Liquid Glass交叉
正确:重新定位或缩放内容,以在稳定状态下保持分离
原因:避免不必要的视觉干扰;滚动/过渡期间的交叉是可接受的。

Scroll Edge Effects

滚动边缘效果

Work in concert with Liquid Glass to maintain separation and legibility with scrolling content.
How they work:
  • Content begins scrolling → effect gently dissolves content into background
  • Lifts glass visually above moving content
  • Floating elements (titles) remain clear
  • Darker content triggers dark style → subtle dimming for contrast
与Liquid Glass协同工作,在内容滚动时保持分离和可读性。
工作原理
  • 内容开始滚动 → 效果将内容逐渐融入背景
  • 将玻璃效果视觉上抬至移动内容之上
  • 浮动元素(标题)保持清晰
  • 较暗的内容触发深色样式 → 微妙调暗以提升对比度

Hard Style Effect

硬样式效果

Use when pinned accessory views exist (e.g., column headers):
swift
ScrollView {
    // Content
}
.scrollEdgeEffect(.hard) // Uniform across toolbar + pinned accessories
When to use: Extra visual separation between floating elements in accessory view and scrolling content.

当存在固定附属视图(如列标题)时使用:
swift
ScrollView {
    // 内容
}
.scrollEdgeEffect(.hard) // 在工具栏+固定附属视图上统一应用
适用场景:在附属视图中的浮动元素与滚动内容之间提供额外的视觉分离。

Tinting & Color

着色与颜色

New Tinting System

全新着色系统

Liquid Glass introduces adaptive tinting that respects material principles and maximizes legibility.
How it works:
  1. Selecting color generates range of tones
  2. Tones mapped to content brightness underneath element
  3. Inspired by colored glass in reality
  4. Changes hue, brightness, saturation based on background
  5. Doesn't deviate too much from intended color
Compatible with all glass behaviors (morphing, adaptation, interaction).
swift
Button("Primary Action") {
    // action
}
.tint(.red) // Adaptive tinting automatically applied
.glassEffect()
Liquid Glass引入了自适应着色,遵循材质原则并最大化可读性。
工作原理
  1. 选择颜色后会生成一系列色调
  2. 色调会根据元素下方内容的亮度进行映射
  3. 灵感来源于现实中的有色玻璃
  4. 根据背景更改色调、亮度、饱和度
  5. 不会与预期颜色偏差过大
与所有玻璃效果行为兼容(变形、自适应、交互)。
swift
Button("主要操作") {
    // 动作
}
.tint(.red) // 自动应用自适应着色
.glassEffect()

Tinting Best Practices

着色最佳实践

✅ DO: Use for Primary Actions

✅ 建议:仅用于主要操作

swift
// Good — Emphasizes primary action
Button("View Bag") {
    // action
}
.tint(.red)
.glassEffect()
swift
// 良好示例 — 强调主要操作
Button("查看购物袋") {
    // 动作
}
.tint(.red)
.glassEffect()

❌ DON'T: Tint Everything

❌ 禁止:给所有元素着色

swift
// Wrong — When everything is tinted, nothing stands out
VStack {
    Button("Action 1").tint(.blue).glassEffect()
    Button("Action 2").tint(.green).glassEffect()
    Button("Action 3").tint(.purple).glassEffect()
} // ❌ Confusing, no hierarchy
Solution: Use color in content layer instead, reserve tinting for primary UI actions.
swift
// 错误示例 — 所有元素都着色的话,没有任何元素会突出
VStack {
    Button("操作1").tint(.blue).glassEffect()
    Button("操作2").tint(.green).glassEffect()
    Button("操作3").tint(.purple).glassEffect()
} // ❌ 混乱,无层级结构
解决方案:在内容层使用颜色,将着色保留给主要UI操作。

Solid Fills vs Tinting

纯色填充 vs 着色

Solid fills break Liquid Glass character:
swift
// ❌ Opaque, breaks visual character
Button("Action") {}
    .background(.red) // Solid, opaque

// ✅ Transparent, grounded in environment
Button("Action") {}
    .tint(.red)
    .glassEffect()

纯色填充会破坏Liquid Glass的特性
swift
// ❌ 不透明,破坏视觉特性
Button("操作") {}
    .background(.red) // 纯色、不透明

// ✅ 透明,贴合环境
Button("操作") {}
    .tint(.red)
    .glassEffect()

Legibility & Contrast

可读性与对比度

Vibrant Text and Tint Colors

活力文本与着色颜色

SwiftUI automatically uses a vibrant text color within glass effects that adapts to maintain legibility against colorful backgrounds. Tints applied to glass elements also use vibrant color that adapts to the content behind them. You do not need to manually adjust text or tint colors — the system handles this.
SwiftUI会自动在玻璃效果内使用活力文本颜色,自适应以在彩色背景上保持可读性。应用于玻璃元素的着色也会使用自适应的活力颜色,以适配其后方的内容。你无需手动调整文本或着色颜色——系统会自动处理。

Automatic Legibility Features

自动可读性特性

Small elements (navbars, tabbars):
  • Constantly adapt appearance based on background
  • Flip light/dark for discernibility
Large elements (menus, sidebars):
  • Adapt based on context
  • Don't flip light/dark (too distracting for large surface area)
Symbols/glyphs:
  • Mirror glass behavior (flip light/dark)
  • Maximize contrast automatically
  • All content on Regular variant receives this treatment
小元素(导航栏、标签栏):
  • 根据背景持续调整外观
  • 切换明暗以保证可识别性
大元素(菜单、侧边栏):
  • 根据场景自适应
  • 不切换明暗(大面积切换会过于分散注意力)
符号/图标:
  • 镜像玻璃效果行为(切换明暗)
  • 自动最大化对比度
  • Regular变体上的所有内容都会应用此处理

Custom Colors

自定义颜色

Use selectively for distinct functional purpose:
swift
// Selective tinting for emphasis
NavigationView {
    List {
        // Content
    }
    .toolbar {
        ToolbarItem {
            Button("Important") {}
                .tint(.orange) // Brings attention
        }
    }
}
Applies to: Labels, text, fully tinted buttons, time on lock screen, etc.

仅用于特定功能目的:
swift
// 选择性着色以强调
NavigationView {
    List {
        // 内容
    }
    .toolbar {
        ToolbarItem {
            Button("重要操作") {}
                .tint(.orange) // 吸引注意力
        }
    }
}
适用对象:标签、文本、完全着色的按钮、锁屏时间等。

Accessibility

可访问性

Liquid Glass offers several accessibility features that modify material without sacrificing its magic:
Liquid Glass提供了多种可访问性功能,在不牺牲其特性的前提下修改材质:

Reduced Transparency

降低透明度

  • Makes Liquid Glass frostier
  • Obscures more content behind it
  • Applied automatically when system setting enabled
  • 让Liquid Glass更像毛玻璃
  • 遮挡更多后方内容
  • 当系统设置启用时自动应用

Increased Contrast

提高对比度

  • Makes elements predominantly black or white
  • Highlights with contrasting border
  • Applied automatically when system setting enabled
  • 让元素主要为黑色或白色
  • 带有对比色边框的高光
  • 当系统设置启用时自动应用

Reduced Motion

减少动效

  • Decreases intensity of effects
  • Disables elastic properties
  • Applied automatically when system setting enabled
Developer Action Required: None - all features available automatically when using Liquid Glass.

  • 降低效果强度
  • 禁用弹性特性
  • 当系统设置启用时自动应用
开发者所需操作:无——使用Liquid Glass时所有功能都会自动生效。

Performance Considerations

性能考量

View Hierarchy Impact

视图层级影响

Concern: Liquid Glass rendering cost in complex view hierarchies
Guidance:
  • Regular variant optimized for performance
  • Larger elements (menus, sidebars) use more pronounced effects but managed by system
  • Avoid excessive nesting of glass elements
Optimization:
swift
// ❌ Avoid deep nesting
ZStack {
    GlassContainer1()
        .glassEffect()
    ZStack {
        GlassContainer2()
            .glassEffect()
        // More nesting...
    }
}

// ✅ Flatten hierarchy
VStack {
    GlassContainer1()
        .glassEffect()

    GlassContainer2()
        .glassEffect()
}
关注点:复杂视图层级中Liquid Glass的渲染成本
指南
  • Regular变体已针对性能优化
  • 较大元素(菜单、侧边栏)使用更明显的效果,但由系统管理
  • 避免过度嵌套玻璃元素
优化示例
swift
// ❌ 避免深层嵌套
ZStack {
    GlassContainer1()
        .glassEffect()
    ZStack {
        GlassContainer2()
            .glassEffect()
        // 更多嵌套...
    }
}

// ✅ 扁平化层级
VStack {
    GlassContainer1()
        .glassEffect()

    GlassContainer2()
        .glassEffect()
}

Rendering Costs

渲染成本

Adaptive behaviors have computational cost:
  • Light/dark switching
  • Shadow adjustments
  • Tint calculations
  • Lensing effects
System handles optimization, but be mindful:
  • Don't animate Liquid Glass elements unnecessarily
  • Use Clear variant sparingly (requires dimming layer computation)
  • Profile with Instruments if experiencing performance issues

自适应行为有计算成本
  • 明暗模式切换
  • 阴影调整
  • 着色计算
  • 透镜效果
系统会处理优化,但需注意:
  • 不要不必要地为Liquid Glass元素添加动画
  • 谨慎使用Clear变体(需要计算调暗层)
  • 如果遇到性能问题,使用Instruments进行分析

Testing Liquid Glass

测试Liquid Glass

Visual Regression Testing

视觉回归测试

Capture screenshots in multiple states:
swift
func testLiquidGlassAppearance() {
    let app = XCUIApplication()
    app.launch()

    // Test light mode
    XCTContext.runActivity(named: "Light Mode Glass") { _ in
        let screenshot = app.screenshot()
        // Compare with baseline
    }

    // Test dark mode
    app.launchArguments = ["-UIUserInterfaceStyle", "dark"]
    app.launch()

    XCTContext.runActivity(named: "Dark Mode Glass") { _ in
        let screenshot = app.screenshot()
        // Compare with baseline
    }
}
在多种状态下捕获截图:
swift
func testLiquidGlassAppearance() {
    let app = XCUIApplication()
    app.launch()

    // 测试浅色模式
    XCTContext.runActivity(named: "Light Mode Glass") { _ in
        let screenshot = app.screenshot()
        // 与基线对比
    }

    // 测试深色模式
    app.launchArguments = ["-UIUserInterfaceStyle", "dark"]
    app.launch()

    XCTContext.runActivity(named: "Dark Mode Glass") { _ in
        let screenshot = app.screenshot()
        // 与基线对比
    }
}

Test Across Configurations

跨配置测试

Critical test cases:
  • ✅ Light mode vs dark mode
  • ✅ Different color schemes (environment)
  • ✅ Reduced Transparency enabled
  • ✅ Increased Contrast enabled
  • ✅ Reduced Motion enabled
  • ✅ Dynamic Type (larger text sizes)
  • ✅ Content scrolling (verify scroll edge effects)
  • ✅ Right-to-left languages
关键测试用例:
  • ✅ 浅色模式 vs 深色模式
  • ✅ 不同配色方案(环境)
  • ✅ 启用降低透明度
  • ✅ 启用提高对比度
  • ✅ 启用减少动效
  • ✅ 动态字体(更大字号)
  • ✅ 内容滚动(验证滚动边缘效果)
  • ✅ 从右到左语言

Accessibility Testing

可访问性测试

swift
func testLiquidGlassAccessibility() {
    // Enable accessibility features via launch arguments
    app.launchArguments += [
        "-UIAccessibilityIsReduceTransparencyEnabled", "1",
        "-UIAccessibilityButtonShapesEnabled", "1",
        "-UIAccessibilityIsReduceMotionEnabled", "1"
    ]

    // Verify glass still functional and legible
    XCTAssertTrue(glassElement.exists)
    XCTAssertTrue(glassElement.isHittable)
}

swift
func testLiquidGlassAccessibility() {
    // 通过启动参数启用可访问性功能
    app.launchArguments += [
        "-UIAccessibilityIsReduceTransparencyEnabled", "1",
        "-UIAccessibilityButtonShapesEnabled", "1",
        "-UIAccessibilityIsReduceMotionEnabled", "1"
    ]

    // 验证玻璃效果仍可用且可读
    XCTAssertTrue(glassElement.exists)
    XCTAssertTrue(glassElement.isHittable)
}

Design Review Pressure: Defending Your Implementation

设计评审压力:捍卫你的实现

The Problem

问题

Under design review pressure, you'll face requests to:
  • "Use Clear variant everywhere — Regular is too opaque"
  • "Glass on all controls for visual cohesion"
  • "More transparency to let content shine through"
These sound reasonable. But they violate the framework. Your job: defend using evidence, not opinion.
在设计评审压力下,你会遇到以下要求:
  • "所有地方都用Clear变体——Regular太不透明了"
  • "所有控件都用玻璃效果以保持视觉一致性"
  • "增加透明度以突出内容"
这些要求听起来合理,但违反了框架规范。你的任务是用证据而非观点来捍卫你的实现。

Red Flags — Designer Requests That Violate Skill Guidelines

危险信号 — 违反技能指南的设计师要求

If you hear ANY of these, STOP and reference the skill:
  • "Use Clear everywhere" – Clear requires three specific conditions, not design preference
  • "Glass looks better than fills" – Correct layer (navigation vs content) trumps aesthetics
  • "Users won't notice the difference" – Clear variant fails legibility tests in low-contrast scenarios
  • "Stack glass on glass for consistency" – Explicitly prohibited; use fills instead
  • "Apply glass to Lists for sophistication" – Lists are content layer; causes visual confusion
如果你听到以下任何要求,请停止并参考本技能
  • "所有地方都用Clear变体" – Clear变体需要满足三个特定条件,而非设计偏好
  • "玻璃效果比填充更好看" – 正确的层级(导航 vs 内容)比美观更重要
  • "用户不会注意到区别" – 在低对比度场景下,Clear变体无法通过可读性测试
  • "叠加玻璃效果以保持一致性" – 明确禁止;改用填充
  • "给列表应用玻璃效果以提升精致感" – 列表属于内容层;会造成视觉混淆

How to Push Back Professionally

如何专业地提出异议

Step 1: Show the Framework

步骤1:展示框架规范

"I want to make this change, but let me show you Apple's guidance on Clear variant.
It requires THREE conditions:

1. Media-rich content background
2. Dimming layer for legibility
3. Bold, bright controls on top

Let me show which screens meet all three..."
"我也想做这个修改,但请让我展示Apple关于Clear变体的指南。
它需要满足三个条件:

1. 媒体丰富的背景内容
2. 用于可读性的调暗层
3. 上方是醒目、明亮的控件

让我展示哪些屏幕满足所有三个条件..."

Step 2: Demonstrate the Risk

步骤2:演示风险

Open the app on a device. Show:
  • Clear variant in low-contrast scenario (unreadable)
  • Regular variant in same scenario (legible)
在设备上打开应用,展示:
  • 低对比度场景下的Clear变体(无法阅读)
  • 相同场景下的Regular变体(可读性良好)

Step 3: Offer Compromise

步骤3:提出折中方案

"Clear can work beautifully in these 6 hero sections where all three conditions apply.
Regular handles everything else with automatic legibility. Best of both worlds."
"Clear变体在这6个满足所有三个条件的核心区域可以完美发挥作用。
Regular变体自动保证所有其他场景的可读性。这样可以兼顾两者的优势。"

Step 4: Document the Decision

步骤4:记录决策

If overruled (designer insists on Clear everywhere):
Slack message to PM + designer:

"Design review decided to use Clear variant across all controls.
Important: Clear variant requires legibility testing in low-contrast scenarios
(bright sunlight, dark content). If we see accessibility issues after launch,
we'll need an expedited follow-up. I'm flagging this proactively."
如果被否决(设计师坚持所有地方都用Clear变体):
给产品经理+设计师的Slack消息:

"设计评审决定在所有控件上使用Clear变体。
重要提示:Clear变体需要在低对比度场景下进行可读性测试
(强光、深色内容)。如果发布后出现可访问性问题,我们需要加急跟进。我在此主动提出风险预警。"

Why this works

为什么这有效

  • You're not questioning their taste (you like Clear too)
  • You're raising accessibility/legibility risk
  • You're offering a solution that preserves their vision in hero sections
  • You're documenting the decision (protects you post-launch)
  • 你没有质疑他们的审美(你也喜欢Clear变体)
  • 你提出了可访问性/可读性风险
  • 你提供了在核心区域保留他们设计愿景的解决方案
  • 你记录了决策(在发布后保护你)

Real-World Example: App Store Launch Blocker (36-Hour Deadline)

真实案例:App Store上线阻塞(36小时截止)

Scenario

场景

  • 36 hours to launch
  • Chief designer says: "Clear variant everywhere"
  • Client watching the review meeting
  • You already implemented Regular per the skill
  • 距离上线还有36小时
  • 首席设计师要求:"所有地方都用Clear变体"
  • 客户正在观看评审会议
  • 你已经按照技能要求实现了Regular变体

What to do

解决方案

swift
// In the meeting, demo side-by-side:

// Regular variant (current implementation)
NavigationBar()
    .glassEffect() // Automatic legibility

// Clear variant (requested)
NavigationBar()
    .glassEffect(.clear) // Requires dimming layer below

// Show the three-condition checklist
// Demonstrate which screens pass/fail
// Offer: Clear in hero sections, Regular elsewhere
swift
// 在会议中,并排演示:

// Regular变体(当前实现)
NavigationBar()
    .glassEffect() // 自动保证可读性

// Clear变体(要求的实现)
NavigationBar()
    .glassEffect(.clear) // 需要下方的调暗层

// 展示三个条件的检查清单
// 演示哪些屏幕符合/不符合条件
// 提出折中方案:核心区域用Clear,其他区域用Regular

Result

结果

  • 30-minute compromise demo
  • 90 minutes to implement changes
  • Launch on schedule with optimal legibility
  • No post-launch accessibility complaints
  • 30分钟的折中演示
  • 90分钟的修改实现
  • 按时上线,可读性最优
  • 发布后无任何可访问性投诉

When to Accept the Design Decision (Even If You Disagree)

何时接受设计决策(即使你不同意)

Sometimes designers have valid reasons to override the skill. Accept if:
  • They understand the three-condition framework
  • They're willing to accept legibility risks
  • You document the decision in writing
  • They commit to monitoring post-launch feedback
有时设计师有充分的理由推翻技能指南。如果满足以下条件,可以接受:
  • 他们理解三个条件的框架
  • 他们愿意承担可读性风险
  • 你以书面形式记录决策
  • 他们承诺监控发布后的反馈

Document in Slack

在Slack中记录

"Design review decided to use Clear variant [in these locations].
We understand this requires:
- All three conditions met: [list them]
- Potential legibility issues in low-contrast scenarios
- Accessibility testing across brightness levels

Monitoring plan:
- Gather user feedback first 48 hours
- Run accessibility audit
- Have fallback to Regular variant ready for push if needed"
This protects both of you and shows you're not blocking - just de-risking.

"设计评审决定在[这些位置]使用Clear变体。
我们理解这需要满足:
- 所有三个条件都已满足:[列出条件]
- 在低对比度场景下可能存在可读性问题
- 跨亮度级别进行可访问性测试

监控计划:
- 收集发布前48小时的用户反馈
- 进行可访问性审计
- 准备好Regular变体作为 fallback,以便在需要时快速推送"
这可以保护双方,同时表明你不是在阻碍,而是在降低风险。

Expert Review Checklist

专家评审清单

When reviewing Liquid Glass implementation (your code or others'), check:
在评审Liquid Glass实现(自己或他人的代码)时,检查以下内容:

1. Material Appropriateness

1. 材质适用性

  • Is Liquid Glass used only on navigation layer (not content)?
  • Are standard controls getting glass automatically via Xcode 26 recompile?
  • Is glass avoided on glass situations?
  • Liquid Glass是否仅用于导航层(而非内容层)?
  • 标准控件是否通过Xcode 26重新编译自动获得玻璃效果?
  • 是否避免了玻璃效果叠加的情况?

2. Variant Selection

2. 变体选择

  • Is Regular variant used for most cases?
  • If Clear variant used, do all three conditions apply?
    • Over media-rich content?
    • Dimming layer acceptable?
    • Content above is bold and bright?
  • Are Regular and Clear never mixed in same interface?
  • 是否在大多数场景下使用Regular变体?
  • 如果使用Clear变体,是否满足所有三个条件?
    • 位于媒体丰富的内容之上?
    • 调暗层是可接受的?
    • 上方内容醒目且明亮?
  • 是否从未在同一界面中混合使用Regular和Clear变体?

3. Legibility & Contrast

3. 可读性与对比度

  • Are primary actions selectively tinted (not everything)?
  • Is color used in content layer for overall app color scheme?
  • Are solid fills avoided on glass elements?
  • Do elements maintain legibility on various backgrounds?
  • 是否仅对主要操作进行选择性着色(而非所有元素)?
  • 是否在内容层使用颜色来定义应用的整体配色方案?
  • 是否避免在玻璃元素上使用纯色填充?
  • 元素在各种背景下是否都保持可读性?

4. Layering & Hierarchy

4. 分层与层级结构

  • Are content intersections avoided in steady states?
  • Are elements on top of glass using fills/transparency (not glass)?
  • Is visual hierarchy clear (navigation layer vs content layer)?
  • 在稳定状态下是否避免了内容交叉?
  • 玻璃上方的元素是否使用填充/透明度(而非玻璃效果)?
  • 视觉层级结构是否清晰(导航层 vs 内容层)?

5. Scroll Edge Effects

5. 滚动边缘效果

  • Are scroll edge effects applied where Liquid Glass meets scrolling content?
  • Is hard style used for pinned accessory views?
  • 在Liquid Glass与滚动内容的交界处是否应用了滚动边缘效果?
  • 是否对固定附属视图使用了硬样式?

6. Accessibility

6. 可访问性

  • Does implementation work with Reduced Transparency?
  • Does implementation work with Increased Contrast?
  • Does implementation work with Reduced Motion?
  • Are interactive elements hittable in all configurations?
  • 实现是否支持降低透明度?
  • 实现是否支持提高对比度?
  • 实现是否支持减少动效?
  • 交互元素在所有配置下是否都可点击?

7. Performance

7. 性能

  • Is view hierarchy reasonably flat?
  • Are glass elements animated only when necessary?
  • Is Clear variant used sparingly?

  • 视图层级是否合理扁平化?
  • 是否仅在必要时为玻璃元素添加动画?
  • 是否谨慎使用Clear变体?

Common Mistakes & Solutions

常见错误与解决方案

Mistake 1: Using Glass Everywhere

错误1:所有地方都用玻璃效果

Wrong:
swift
List(landmarks) { landmark in
    LandmarkRow(landmark)
        .glassEffect() // ❌
}
.glassEffect() // ❌
Correct:
swift
NavigationView {
    List(landmarks) { landmark in
        LandmarkRow(landmark) // No glass
    }
}
.toolbar {
    ToolbarItem {
        Button("Add") {}
            .glassEffect() // ✅ Navigation layer only
    }
}
Why: Content layer should defer to Liquid Glass navigation layer.
错误示例
swift
List(landmarks) { landmark in
    LandmarkRow(landmark)
        .glassEffect() // ❌
}
.glassEffect() // ❌
正确示例
swift
NavigationView {
    List(landmarks) { landmark in
        LandmarkRow(landmark) // 无玻璃效果
    }
}
.toolbar {
    ToolbarItem {
        Button("添加") {}
            .glassEffect() // ✅ 仅在导航层使用
    }
}
原因:内容层应让位于Liquid Glass导航层。

Mistake 2: Clear Variant Without Dimming

错误2:使用Clear变体但无调暗层

Wrong:
swift
ZStack {
    VideoPlayer(player: player)

    PlayButton()
        .glassEffect(.clear) // ❌ No dimming, poor legibility
}
Correct:
swift
ZStack {
    VideoPlayer(player: player)
        .overlay(.black.opacity(0.4)) // Dimming layer

    PlayButton()
        .glassEffect(.clear) // ✅
}
错误示例
swift
ZStack {
    VideoPlayer(player: player)

    PlayButton()
        .glassEffect(.clear) // ❌ 无调暗层,可读性差
}
正确示例
swift
ZStack {
    VideoPlayer(player: player)
        .overlay(.black.opacity(0.4)) // 调暗层

    PlayButton()
        .glassEffect(.clear) // ✅
}

Mistake 3: Over-Tinting

错误3:过度着色

Wrong: All buttons tinted different colors
Correct: Primary action tinted, others use standard appearance
错误:所有按钮都使用不同颜色着色
正确:仅对主要操作着色,其他使用标准外观

Mistake 4: Static Material Expectations

错误4:静态材质预期

Wrong: Assuming glass always looks the same (e.g., hardcoded shadows, fixed opacity)
Correct: Embrace adaptive behavior, test across light/dark modes and backgrounds

错误:假设玻璃效果始终看起来相同(如硬编码阴影、固定透明度)
正确:接受自适应行为,在明暗模式和不同背景下进行测试

Troubleshooting

故障排除

Visual Artifacts

视觉瑕疵

Issue: Glass appears too transparent or invisible
Check:
  1. Are you using Clear variant? (Switch to Regular if inappropriate)
  2. Is background content extremely light or dark? (Glass adapts - this may be correct behavior)
  3. Is Reduced Transparency enabled? (Check accessibility settings)
Issue: Glass appears opaque or has harsh edges
Check:
  1. Are you using solid fills on glass? (Remove, use tinting)
  2. Is Increased Contrast enabled? (Expected behavior)
  3. Is custom shape too complex? (Simplify geometry)
问题:玻璃效果看起来过于透明或不可见
检查项
  1. 是否使用了Clear变体?(如果不合适,切换为Regular)
  2. 背景内容是否极亮或极暗?(玻璃效果会自适应——这可能是正常行为)
  3. 是否启用了降低透明度?(检查可访问性设置)
问题:玻璃效果看起来不透明或边缘生硬
检查项
  1. 是否在玻璃元素上使用了纯色填充?(移除,改用着色)
  2. 是否启用了提高对比度?(这是预期行为)
  3. 自定义形状是否过于复杂?(简化几何形状)

Dark Mode Issues

深色模式问题

Issue: Glass doesn't flip to dark style on dark backgrounds
Check:
  1. Is element large (menu, sidebar)? (Large elements don't flip - by design)
  2. Is background actually dark? (Use Color Picker to verify)
  3. Are you overriding appearance? (Remove
    .preferredColorScheme()
    if unintended)
Issue: Content on glass not legible in dark mode
Fix:
swift
// Let SwiftUI handle contrast automatically
Text("Label")
    .foregroundStyle(.primary) // ✅ Adapts automatically

// Don't hardcode colors
Text("Label")
    .foregroundColor(.black) // ❌ Won't adapt to dark mode
问题:在深色背景上,玻璃效果未切换为深色样式
检查项
  1. 元素是否较大(菜单、侧边栏)?(大元素不会切换——这是设计使然)
  2. 背景是否真的是深色?(使用取色器验证)
  3. 是否覆盖了外观设置?(如果非预期,移除
    .preferredColorScheme()
问题:深色模式下玻璃效果上的内容不可读
修复方案
swift
// 让SwiftUI自动处理对比度
Text("标签")
    .foregroundStyle(.primary) // ✅ 自动自适应

// 不要硬编码颜色
Text("标签")
    .foregroundColor(.black) // ❌ 不会适配深色模式

Performance Issues

性能问题

Issue: Scrolling feels janky with Liquid Glass
Debug:
  1. Profile with Instruments (see
    axiom-swiftui-performance
    skill)
  2. Check for excessive view body updates
  3. Simplify view hierarchy under glass
  4. Verify not applying glass to content layer (major performance hit)
Issue: Animations stuttering
Check:
  1. Are you animating glass shape changes? (Expensive)
  2. Profile with SwiftUI Instrument for long view updates
  3. Consider reducing glass usage if critical path

问题:使用Liquid Glass时滚动卡顿
调试
  1. 使用Instruments进行分析(参考
    axiom-swiftui-performance
    技能)
  2. 检查是否存在过度的视图体更新
  3. 简化玻璃效果下方的视图层级
  4. 确认未在内容层应用玻璃效果(这会严重影响性能)
问题:动画卡顿
检查项
  1. 是否为玻璃形状变化添加了动画?(成本很高)
  2. 使用SwiftUI Instrument分析长时间的视图更新
  3. 如果在关键路径上,考虑减少玻璃效果的使用

Migration from Previous Materials

从旧材质迁移

From UIBlurEffect / NSVisualEffectView

从UIBlurEffect / NSVisualEffectView迁移

Before (UIKit):
swift
let blurEffect = UIBlurEffect(style: .systemMaterial)
let blurView = UIVisualEffectView(effect: blurEffect)
view.addSubview(blurView)
After (SwiftUI with Liquid Glass):
swift
ZStack {
    // Content
}
.glassEffect()
Benefits:
  • Automatic adaptation (no manual style switching)
  • Built-in interaction feedback
  • Platform-appropriate appearance
  • Accessibility features included
之前的实现(UIKit):
swift
let blurEffect = UIBlurEffect(style: .systemMaterial)
let blurView = UIVisualEffectView(effect: blurEffect)
view.addSubview(blurView)
之后的实现(使用Liquid Glass的SwiftUI):
swift
ZStack {
    // 内容
}
.glassEffect()
优势
  • 自动自适应(无需手动切换样式)
  • 内置交互反馈
  • 符合平台的外观
  • 包含可访问性功能

From Custom Materials

从自定义材质迁移

If you've built custom translucent effects:
  1. Try Liquid Glass first — may provide desired effect automatically
  2. Evaluate Regular vs Clear — Clear may match custom transparency needs
  3. Test across configurations — Liquid Glass adapts automatically
  4. Measure performance — Likely improvement over custom implementations
When to keep custom materials:
  • Specific artistic effect not achievable with Liquid Glass
  • Backward compatibility with iOS < 26 required
  • Non-standard UI paradigm incompatible with Liquid Glass principles

如果你已经实现了自定义半透明效果:
  1. 先尝试Liquid Glass — 可能会自动提供你想要的效果
  2. 评估Regular vs Clear变体 — Clear变体可能匹配你的自定义透明度需求
  3. 跨配置测试 — Liquid Glass会自动自适应
  4. 测量性能 — 性能可能比自定义实现更好
何时保留自定义材质
  • Liquid Glass无法实现的特定艺术效果
  • 需要兼容iOS < 26
  • 非标准UI范式与Liquid Glass原则不兼容

API Reference

API参考

SwiftUI Modifiers

SwiftUI修饰符

glassEffect(in:isInteractive:)

glassEffect(in:isInteractive:)

Applies Liquid Glass effect to view.
swift
func glassEffect<S: Shape>(
    in shape: S = Capsule(),
    isInteractive: Bool = false
) -> some View
Parameters:
  • shape
    : Shape defining glass bounds (default:
    Capsule()
    )
  • isInteractive
    : On iOS, enables interactive mode for custom controls (default:
    false
    )
Returns: View with Liquid Glass effect applied
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+, axiom-visionOS 3+
Example:
swift
// Default capsule shape
Text("Hello").glassEffect()

// Custom shape
Text("Hello").glassEffect(in: RoundedRectangle(cornerRadius: 16))

// Interactive (iOS)
Button("Tap") {}.glassEffect(isInteractive: true)
为视图应用Liquid Glass效果。
swift
func glassEffect<S: Shape>(
    in shape: S = Capsule(),
    isInteractive: Bool = false
) -> some View
参数
  • shape
    : 定义玻璃效果边界的形状(默认:
    Capsule()
  • isInteractive
    : 在iOS上,为自定义控件启用交互模式(默认:
    false
返回值:应用了Liquid Glass效果的视图
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+、axiom-visionOS 3+
示例
swift
// 默认胶囊形状
Text("Hello").glassEffect()

// 自定义形状
Text("Hello").glassEffect(in: RoundedRectangle(cornerRadius: 16))

// 交互模式(iOS)
Button("Tap").glassEffect(isInteractive: true)

glassEffect(_:in:isInteractive:)

glassEffect(_:in:isInteractive:)

Applies specific Liquid Glass variant.
swift
func glassEffect<S: Shape>(
    _ variant: GlassVariant,
    in shape: S = Capsule(),
    isInteractive: Bool = false
) -> some View
Parameters:
  • variant
    :
    .regular
    or
    .clear
  • shape
    : Shape defining glass bounds
  • isInteractive
    : Interactive mode for custom controls (iOS)
Example:
swift
Text("Hello").glassEffect(.clear, in: Circle())
应用特定的Liquid Glass变体。
swift
func glassEffect<S: Shape>(
    _ variant: GlassVariant,
    in shape: S = Capsule(),
    isInteractive: Bool = false
) -> some View
参数
  • variant
    :
    .regular
    .clear
  • shape
    : 定义玻璃效果边界的形状
  • isInteractive
    : 自定义控件的交互模式(iOS)
示例
swift
Text("Hello").glassEffect(.clear, in: Circle())

scrollEdgeEffect(_:)

scrollEdgeEffect(_:)

Configures scroll edge appearance with Liquid Glass.
swift
func scrollEdgeEffect(_ style: ScrollEdgeStyle) -> some View
Parameters:
  • style
    :
    .automatic
    ,
    .soft
    , or
    .hard
Example:
swift
ScrollView {
    // Content
}
.scrollEdgeEffect(.hard) // For pinned accessories
配置Liquid Glass的滚动边缘外观。
swift
func scrollEdgeEffect(_ style: ScrollEdgeStyle) -> some View
参数
  • style
    :
    .automatic
    .soft
    .hard
示例
swift
ScrollView {
    // 内容
}
.scrollEdgeEffect(.hard) // 用于固定附属视图

scrollEdgeEffectStyle(_:for:)
NEW in iOS 26

scrollEdgeEffectStyle(_:for:)
iOS 26新增

Optimizes legibility for controls when content scrolls beneath them.
swift
func scrollEdgeEffectStyle(_ style: ScrollEdgeStyle, for edges: Edge.Set) -> some View
Parameters:
  • style
    :
    .hard
    ,
    .soft
    , or
    .automatic
  • edges
    : Which edges to apply effect (
    .top
    ,
    .bottom
    ,
    .leading
    ,
    .trailing
    )
Use case: Custom bars with controls, text, or icons that have content scrolling beneath them. System bars (toolbars, navigation bars) adopt this automatically.
Example:
swift
// Custom toolbar with controls
CustomToolbar()
    .scrollEdgeEffectStyle(.hard, for: .top) // Maintain legibility

ScrollView {
    LazyVStack {
        ForEach(items) { item in
            ItemRow(item)
        }
    }
}
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+
当内容在控件下方滚动时,优化控件的可读性。
swift
func scrollEdgeEffectStyle(_ style: ScrollEdgeStyle, for edges: Edge.Set) -> some View
参数
  • style
    :
    .hard
    .soft
    .automatic
  • edges
    : 应用效果的边缘(
    .top
    .bottom
    .leading
    .trailing
适用场景:自定义工具栏包含控件、文本或图标,且内容在其下方滚动。系统栏(工具栏、导航栏)会自动应用此效果。
示例
swift
// 带控件的自定义工具栏
CustomToolbar()
    .scrollEdgeEffectStyle(.hard, for: .top) // 保持可读性

ScrollView {
    LazyVStack {
        ForEach(items) { item in
            ItemRow(item)
        }
    }
}
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+

glassBackgroundEffect()
NEW in iOS 26

glassBackgroundEffect()
iOS 26新增

Applies glass effect to custom views for reflecting surrounding content.
swift
func glassBackgroundEffect() -> some View
Use case: Apply Liquid Glass appearance to custom views (not buttons/controls) that should beautifully reflect surrounding content like photos.
Example:
swift
struct PhotoGalleryView: View {
    var body: some View {
        CustomPhotoGrid()
            .glassBackgroundEffect() // Reflects surrounding photos
    }
}
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+, axiom-visionOS 3+
为自定义视图应用玻璃效果,以反射周围内容。
swift
func glassBackgroundEffect() -> some View
适用场景:为自定义视图(非按钮/控件)应用Liquid Glass外观,使其能优美地反射周围内容(如照片)。
示例
swift
struct PhotoGalleryView: View {
    var body: some View {
        CustomPhotoGrid()
            .glassBackgroundEffect() // 反射周围的照片
    }
}
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+、axiom-visionOS 3+

Toolbar Modifiers NEW in iOS 26

工具栏修饰符 iOS 26新增

.toolbar
with
ToolbarSpacer(.fixed)

.toolbar
搭配
ToolbarSpacer(.fixed)

Separates toolbar button groups with fixed spacing.
swift
.toolbar {
    ToolbarItemGroup(placement: .topBarTrailing) {
        Button("Up") { }
        Button("Down") { }

        ToolbarSpacer(.fixed) // Fixed spacer separates groups

        Button("Settings") { }
    }
}
Why use
.fixed
: Creates logical visual separation between button groups. Default
Spacer()
is flexible and adjusts based on available space;
.fixed
maintains consistent separation.
Common pattern: Separate navigation buttons from action buttons, or primary actions from secondary actions.
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+
使用固定间距分隔工具栏按钮组。
swift
.toolbar {
    ToolbarItemGroup(placement: .topBarTrailing) {
        Button("Up") { }
        Button("Down") { }

        ToolbarSpacer(.fixed) // 固定间距分隔按钮组

        Button("Settings") { }
    }
}
使用
.fixed
的原因
:为按钮组创建逻辑视觉分隔。默认的
Spacer()
是灵活的,会根据可用空间调整;
.fixed
保持一致的间距。
常见模式:将导航按钮与操作按钮分离,或将主要操作与次要操作分离。
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+

.buttonStyle(.borderedProminent)
+
.tint()
in Toolbars

.buttonStyle(.borderedProminent)
+
.tint()
在工具栏中

Makes toolbar items more prominent with Liquid Glass tinting.
swift
.toolbar {
    ToolbarItem(placement: .topBarTrailing) {
        Button("Add Trip") {
            addTrip()
        }
        .buttonStyle(.borderedProminent)
        .tint(.blue) // Liquid Glass toolbars support tinting
    }
}
Visual effect: Button appears with bordered prominent style and custom tint color, making it stand out against Liquid Glass toolbar background.
Best practice: Use for primary actions in toolbars. Don't over-tint - use for prominence, not decoration.
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+
通过Liquid Glass着色让工具栏项更突出。
swift
.toolbar {
    ToolbarItem(placement: .topBarTrailing) {
        Button("Add Trip") {
            addTrip()
        }
        .buttonStyle(.borderedProminent)
        .tint(.blue) // Liquid Glass工具栏支持着色
    }
}
视觉效果:按钮带有边框突出样式和自定义着色,在Liquid Glass工具栏背景上更醒目。
最佳实践:用于工具栏中的主要操作。不要过度着色——仅用于突出显示,而非装饰。
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+

Navigation & Search NEW in iOS 26

导航与搜索 iOS 26新增

Bottom-Aligned Search

底部对齐搜索

Search automatically appears bottom-aligned on iPhone (more ergonomic), top-trailing on iPad.
swift
NavigationSplitView {
    List { }
        .searchable(text: $searchText)
}
// Placement on NavigationSplitView automatically:
// - Bottom-aligned on iPhone
// - Top trailing corner on iPad
No code changes required — existing
.searchable()
modifier automatically adopts platform-specific placement.
Why bottom-aligned: More ergonomic to reach on iPhone with thumb-based interaction.
Availability: iOS 26+, iPadOS 26+
搜索框在iPhone上自动底部对齐(更符合人体工程学),在iPad上自动右上角对齐。
swift
NavigationSplitView {
    List { }
        .searchable(text: $searchText)
}
// 在NavigationSplitView上的位置自动适配:
// - iPhone上底部对齐
// - iPad上右上角对齐
无需修改代码 — 现有的
.searchable()
修饰符会自动采用平台特定的位置。
底部对齐的原因:在iPhone上用拇指操作更符合人体工程学。
兼容性:iOS 26+、iPadOS 26+

Search Tab Role

搜索标签角色

Separates search tab from other tabs in tab bar, morphs into search field.
swift
TabView {
    SearchView()
        .tabItem { Label("Search", systemImage: "magnifyingglass") }
        .tabRole(.search) // Separated from other tabs, morphs into search

    TripsView()
        .tabItem { Label("Trips", systemImage: "map") }
}
Visual effect: Search tab appears separated from other tabs in the tab bar. When tapped, morphs into the search field.
Use case: Tab-based apps where search is a primary destination.
Availability: iOS 26+
在标签栏中将搜索标签与其他标签分离,点击时转换为搜索框。
swift
TabView {
    SearchView()
        .tabItem { Label("Search", systemImage: "magnifyingglass") }
        .tabRole(.search) // 与其他标签分离,点击转换为搜索框

    TripsView()
        .tabItem { Label("Trips", systemImage: "map") }
}
视觉效果:搜索标签在标签栏中与其他标签分离。点击时,会转换为搜索框。
适用场景:以搜索为主要功能的标签式应用。
兼容性:iOS 26+

Controls and Layout NEW in iOS 26

控件与布局 iOS 26新增

containerRelativeShape()

containerRelativeShape()

Aligns control shapes with container curvature for visual continuity.
swift
func containerRelativeShape(_ shape: ContainerRelativeShape) -> some View
Parameters:
  • shape
    : Shape that aligns with container (e.g.,
    .roundedRectangle
    )
Use case: Create visual harmony by making controls concentric to their containers (sheets concentric to windows, controls concentric to sheets).
Example:
swift
// Control shape aligns with container curvature
Button("Action") { }
    .containerRelativeShape(.roundedRectangle)
    .glassEffect()
Visual Effect Nested elements feel visually harmonious, with curvature matching container shape.
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+
让控件形状与容器曲率对齐,实现视觉连续性。
swift
func containerRelativeShape(_ shape: ContainerRelativeShape) -> some View
参数
  • shape
    : 与容器对齐的形状(如
    .roundedRectangle
适用场景:通过让控件与容器曲率同心,创建视觉和谐(如弹窗与窗口同心,控件与弹窗同心)。
示例
swift
// 控件形状与容器曲率对齐
Button("Action") { }
    .containerRelativeShape(.roundedRectangle)
    .glassEffect()
视觉效果:嵌套元素视觉和谐,曲率与容器形状匹配。
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+

tabBarMinimizeBehavior(_:)
NEW in iOS 26

tabBarMinimizeBehavior(_:)
iOS 26新增

Configures tab bar to minimize when scrolling to elevate underlying content.
swift
func tabBarMinimizeBehavior(_ behavior: TabBarMinimizeBehavior) -> some View
Parameters:
  • behavior
    :
    .onScrollDown
    ,
    .onScrollUp
    ,
    .automatic
    , or
    .never
Use case: Content-focused apps (reading, media) where tab bar should recede during scrolling.
Example:
swift
TabView {
    ContentView()
        .tabItem { Label("Home", systemImage: "house") }
}
.tabBarMinimizeBehavior(.onScrollDown) // Minimize when scrolling down
Visual Effect Tab bar recedes when scrolling down, expands when scrolling up. Content gains more screen space.
Gotcha: Tab bar blur only activates when the tab bar overlays scrollable content. If non-scrollable views (buttons, fixed VStacks) sit between your list and the tab bar, you get a solid background instead of blur. Ensure your primary scrollable view is the outermost content layer.
swift
// ❌ Solid background — Button breaks scrollable overlay
VStack {
    List { /* items */ }
    Button("Add") { }  // Sits between list and tab bar
}

// ✅ Blurred background — List extends under tab bar
ZStack(alignment: .bottomTrailing) {
    List { /* items */ }  // Scrollable content under tab bar
    Button(action: { }) {
        Label("Add", systemImage: "plus")
            .labelStyle(.iconOnly).padding()
    }
    .glassEffect(.regular.interactive())
    .padding([.bottom, .trailing], 12)
}
Availability: iOS 26+
配置标签栏在滚动时最小化,以突出下方内容。
swift
func tabBarMinimizeBehavior(_ behavior: TabBarMinimizeBehavior) -> some View
参数
  • behavior
    :
    .onScrollDown
    .onScrollUp
    .automatic
    .never
适用场景:以内容为中心的应用(阅读、媒体),标签栏应在滚动时隐藏。
示例
swift
TabView {
    ContentView()
        .tabItem { Label("Home", systemImage: "house") }
}
.tabBarMinimizeBehavior(.onScrollDown) // 向下滚动时最小化
视觉效果:向下滚动时标签栏隐藏,向上滚动时展开。内容获得更多屏幕空间。
注意事项:只有当标签栏覆盖可滚动内容时,标签栏的模糊效果才会激活。如果列表与标签栏之间有不可滚动视图(按钮、固定VStack),则会显示纯色背景而非模糊。请确保主可滚动视图是最外层的内容层。
swift
// ❌ 纯色背景 — 按钮破坏了可滚动覆盖
VStack {
    List { /* 列表项 */ }
    Button("Add") { }  // 位于列表与标签栏之间
}

// ✅ 模糊背景 — 列表延伸至标签栏下方
ZStack(alignment: .bottomTrailing) {
    List { /* 列表项 */ }  // 可滚动内容位于标签栏下方
    Button(action: { }) {
        Label("Add", systemImage: "plus")
            .labelStyle(.iconOnly).padding()
    }
    .glassEffect(.regular.interactive())
    .padding([.bottom, .trailing], 12)
}
兼容性:iOS 26+

Floating Glass Buttons

浮动玻璃按钮

Liquid Glass replaces bottom-anchored action buttons with floating glass buttons. Use
.glassEffect(.regular.interactive())
on a
ZStack
-overlaid button:
swift
ZStack(alignment: .bottomTrailing) {
    ScrollView {
        // Main content
    }

    Button(action: { addItem() }) {
        Label("Add Item", systemImage: "plus")
            .bold()
            .labelStyle(.iconOnly)
            .padding()
    }
    .glassEffect(.regular.interactive())
    .padding([.bottom, .trailing], 12)
}
When to use: Replace pre-iOS 26 bottom-bar action buttons that no longer fit the layered Liquid Glass design.
Availability: iOS 26+
Liquid Glass用浮动玻璃按钮替代底部锚定的操作按钮。在ZStack叠加的按钮上使用
.glassEffect(.regular.interactive())
swift
ZStack(alignment: .bottomTrailing) {
    ScrollView {
        // 主内容
    }

    Button(action: { addItem() }) {
        Label("Add Item", systemImage: "plus")
            .bold()
            .labelStyle(.iconOnly)
            .padding()
    }
    .glassEffect(.regular.interactive())
    .padding([.bottom, .trailing], 12)
}
适用场景:替代iOS 26之前的底部栏操作按钮,这些按钮不再符合分层Liquid Glass设计。
兼容性:iOS 26+

Types

类型定义

GlassVariant

GlassVariant

swift
enum GlassVariant {
    case regular  // Default - full adaptive behavior
    case clear    // More transparent, no adaptation
}
swift
enum GlassVariant {
    case regular  // 默认 - 完整自适应行为
    case clear    // 更高透明度,无自适应
}

ScrollEdgeStyle

ScrollEdgeStyle

swift
enum ScrollEdgeStyle {
    case automatic  // System determines style
    case soft       // Gradual fade
    case hard       // Uniform effect across toolbar height
}
swift
enum ScrollEdgeStyle {
    case automatic  // 系统决定样式
    case soft       // 渐变淡出
    case hard       // 在工具栏高度上统一应用效果
}

GlassEffectContainer
NEW in iOS 26

GlassEffectContainer
iOS 26新增

Container for combining multiple Liquid Glass effects with correct visual behavior.
swift
struct GlassEffectContainer<Content: View>: View {
    init(@ViewBuilder content: () -> Content)
}
Why this is essential: Glass samples content from an area larger than itself to produce its reflections and refractions. However, glass cannot sample other glass — nearby glass elements in different containers will produce inconsistent visual behavior. Using a
GlassEffectContainer
allows elements to share their sampling region, providing a consistent visual result.
用于组合多个Liquid Glass效果的容器,保证正确的视觉行为。
swift
struct GlassEffectContainer<Content: View>: View {
    init(@ViewBuilder content: () -> Content)
}
为什么这很重要:玻璃效果会从比自身更大的区域采样内容以生成反射和折射。但玻璃效果无法采样其他玻璃效果——不同容器中相邻的玻璃元素会产生不一致的视觉行为。使用
GlassEffectContainer
可以让元素共享采样区域,提供一致的视觉效果。

Example

示例

swift
// ✅ Shared sampling region — consistent visual result
GlassEffectContainer {
    HStack {
        Button("Action 1") { }
            .glassEffect()

        Button("Action 2") { }
            .glassEffect()

        Button("Action 3") { }
            .glassEffect()
    }
}

// ❌ Separate containers — inconsistent glass behavior
HStack {
    Button("Action 1") { }.glassEffect()  // Samples independently
    Button("Action 2") { }.glassEffect()  // Can't sample neighbor's glass
}
swift
// ✅ 共享采样区域 — 视觉效果一致
GlassEffectContainer {
    HStack {
        Button("Action 1") { }
            .glassEffect()

        Button("Action 2") { }
            .glassEffect()

        Button("Action 3") { }
            .glassEffect()
    }
}

// ❌ 独立容器 — 玻璃效果行为不一致
HStack {
    Button("Action 1") { }.glassEffect()  // 独立采样
    Button("Action 2") { }.glassEffect()  // 无法采样相邻的玻璃效果
}

Benefits

优势

  • Correct visual behavior (shared sampling region)
  • Fluidly morphs Liquid Glass shapes into each other
  • Optimizes rendering performance
  • Reduces compositor overhead
  • 正确的视觉行为(共享采样区域)
  • Liquid Glass形状可流畅地相互变形
  • 优化渲染性能
  • 减少合成器开销

When to use

适用场景

  • Multiple custom Liquid Glass elements near each other
  • Morphing animations between glass shapes
  • Any time glass elements are visually adjacent
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+, axiom-visionOS 3+
  • 多个自定义Liquid Glass元素相邻
  • 玻璃形状之间的变形动画
  • 任何玻璃元素视觉上相邻的场景
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+、axiom-visionOS 3+

glassEffectID
NEW in iOS 26

glassEffectID
iOS 26新增

Enables fluid morphing transitions between glass elements using a namespace. When elements share a namespace and transition between states, glass morphs fluidly between shapes.
swift
@Namespace private var glassNamespace

// Associate glass elements with IDs in the namespace
ForEach(badges) { badge in
    BadgeView(badge: badge)
        .glassEffect()
        .glassEffectID(badge.id, in: glassNamespace)
}

// A toolbar button with the same namespace absorbs/expands badges
Button("Awards", systemImage: "star.fill") {
    toggleBadges()
}
.glassEffect()
.glassEffectID("awards", in: glassNamespace)
Use case: Award badges expanding from a toolbar button, controls morphing between states, expanding/collapsing glass elements.
Availability: iOS 26+, iPadOS 26+, macOS Tahoe+

使用命名空间实现玻璃元素之间的流畅变形过渡。当元素共享命名空间并在状态间转换时,玻璃效果会在形状间流畅变形。
swift
@Namespace private var glassNamespace

// 将玻璃元素与命名空间中的ID关联
ForEach(badges) { badge in
    BadgeView(badge: badge)
        .glassEffect()
        .glassEffectID(badge.id, in: glassNamespace)
}

// 带有相同命名空间的工具栏按钮可吸收/展开徽章
Button("Awards", systemImage: "star.fill") {
    toggleBadges()
}
.glassEffect()
.glassEffectID("awards", in: glassNamespace)
适用场景:从工具栏按钮展开的奖励徽章、控件在状态间的变形、玻璃元素的展开/折叠。
兼容性:iOS 26+、iPadOS 26+、macOS Tahoe+

Backward Compatibility

向后兼容性

UIDesignRequiresCompatibility Key NEW in iOS 26

UIDesignRequiresCompatibility键 iOS 26新增

To ship with latest SDKs while maintaining previous appearance:
使用最新SDK构建应用,同时保持之前的外观:

Add to Info.plist

添加到Info.plist

xml
<key>UIDesignRequiresCompatibility</key>
<true/>
xml
<key>UIDesignRequiresCompatibility</key>
<true/>

Effect

效果

  • App built with iOS 26 SDK
  • Appearance matches iOS 18 and earlier
  • Liquid Glass effects disabled
  • Previous blur/material styles used
  • 使用iOS 26 SDK构建应用
  • 外观与iOS 18及更早版本一致
  • 禁用Liquid Glass效果
  • 使用之前的模糊/材质样式

When to use

适用场景

  • Need time to audit interface changes
  • Gradual adoption strategy
  • Maintain exact appearance temporarily
  • 需要时间审核界面变化
  • 渐进式采用策略
  • 暂时保持完全一致的外观

Migration strategy

迁移策略

  1. Ship with
    UIDesignRequiresCompatibility
    enabled
  2. Audit interface changes in separate build
  3. Update interface incrementally
  4. Remove key when ready for Liquid Glass
Availability: iOS 26+, iPadOS 26+

  1. 启用
    UIDesignRequiresCompatibility
    发布应用
  2. 在单独的构建中审核界面变化
  3. 逐步更新界面
  4. 准备好采用Liquid Glass后移除该键
兼容性:iOS 26+、iPadOS 26+

Resources

资源

WWDC: 2025-219, 2025-256, 2025-323 (Build a SwiftUI app with the new design)
Docs: /technologyoverviews/adopting-liquid-glass, /swiftui/landmarks-building-an-app-with-liquid-glass, /swiftui/applying-liquid-glass-to-custom-views
Skills: axiom-liquid-glass-ref

Platforms: iOS 26+, iPadOS 26+, macOS Tahoe, axiom-visionOS 3 Xcode: 26+ History: See git log for changes
WWDC:2025-219、2025-256、2025-323(使用新设计构建SwiftUI应用)
文档:/technologyoverviews/adopting-liquid-glass、/swiftui/landmarks-building-an-app-with-liquid-glass、/swiftui/applying-liquid-glass-to-custom-views
技能:axiom-liquid-glass-ref

平台: iOS 26+、iPadOS 26+、macOS Tahoe、axiom-visionOS 3 Xcode: 26+ 历史: 查看git日志了解变更