axiom-liquid-glass-ref by charleswiltgen/axiom
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-liquid-glass-ref在以下情况时使用:
axiom-liquid-glass 来实现 Liquid Glass 材质本身以及设计审查压力场景axiom-swiftui-performance 来分析 Liquid Glass 渲染性能axiom-accessibility-diag 进行无障碍访问测试采用 Liquid Glass 并不意味着要从头开始重新构建你的应用。首先使用最新版本的 Xcode 构建你的应用以查看变化。如果你的应用使用了 SwiftUI、UIKit 或 AppKit 的标准组件,那么在最新的平台版本上,你的界面会自动获得最新的外观和感觉。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
来自 SwiftUI、UIKit 和 AppKit 的标准组件会自动采用 Liquid Glass,只需最少的代码更改。
// ✅ 标准组件自动获得 Liquid Glass 效果
NavigationView {
List(items) { item in
Text(item.name)
}
.toolbar {
ToolbarItem {
Button("Add") { }
}
}
}
// 使用 Xcode 26 重新编译 → Liquid Glass 已应用
// ❌ 自定义背景会干扰 Liquid Glass 效果
NavigationView { }
.background(Color.blue.opacity(0.5)) // 破坏 Liquid Glass 效果
.toolbar {
ToolbarItem { }
.background(LinearGradient(...)) // 覆盖系统效果
}
解决方案 移除自定义效果,让系统决定背景外观。
Liquid Glass 会适应以下设置:降低透明度(更霜化)、增加对比度(黑色/白色边框)、减弱动态效果(无弹性动画)。验证每种设置下可读性是否保持,以及自定义元素是否提供了备用体验。有关详细的无障碍访问测试工作流,请参阅 axiom-liquid-glass 学科技能。
app.launchArguments += ["-UIAccessibilityIsReduceTransparencyEnabled", "1",
"-UIAccessibilityButtonShapesEnabled", "1", "-UIAccessibilityIsReduceMotionEnabled", "1"]
Liquid Glass 会将注意力引向底层内容。在多个自定义控件上过度使用它会分散对内容的注意力。仅对重要的功能元素(导航、主要操作)应用 .glassEffect() — 而不是内容卡片、列表行或装饰性元素。
// ✅ 内容层:无玻璃效果。导航层:仅对功能按钮应用玻璃效果。
ZStack {
ScrollView { ForEach(articles) { ArticleCard($0) } }
VStack {
Spacer()
HStack {
Button("Filter") { }.glassEffect()
Spacer()
Button("Sort") { }.glassEffect()
}.padding()
}
}
应用图标现在采用了动态且富有表现力的设计。图标网格的更新带来了标准化的图标设计,在不同设备上保持视觉一致性。应用图标包含动态响应光照和视觉效果的分层。
分层图标:iOS/iPadOS 26+、macOS Tahoe+、watchOS(圆形遮罩)。外观变体:默认(浅色)、深色、透明、着色(主屏幕个性化)。
设计简洁、简化的图层,使用实心填充和半透明叠加。让系统处理效果(反射、折射、阴影、模糊、遮罩)。不要预先应用模糊、手动阴影、硬编码高光或固定遮罩。
三个图层:前景(主要元素)、中间(辅助)、背景(基础)。将每个图层导出为 PNG 或 SVG,保留透明度,分辨率分别为 @1x/@2x/@3x。
包含在 Xcode 26+ 中(也可从 developer.apple.com/design/resources 单独下载)。拖放图层,添加可选背景,调整属性(不透明度、位置、缩放),预览系统效果和所有外观变体,直接导出到资源目录。
网格:iOS/iPadOS/macOS 使用圆角矩形遮罩;watchOS 使用圆形遮罩。从 developer.apple.com/design/resources 下载。保持元素居中以避免裁剪,在所有尺寸下测试,验证所有外观变体看起来都符合预期。
控件在所有平台上都焕然一新,并在交互时变得生动。旋钮在交互时转变为 Liquid Glass,按钮流畅地变形为菜单/弹出框。硬件形状决定了控件的曲率(更圆润的形态贴合角落)。
带边框的按钮默认为胶囊形状(macOS 上的 mini/small/medium 尺寸保留圆角矩形)。旋钮在交互时转变为玻璃效果;按钮变形为菜单/弹出框。新的 controlSize(.extraLarge) 选项;在 macOS 上高度略高。对于向后兼容的高密度布局,使用 controlSize(.small)。标准控件会自动采用 — 移除硬编码的 .frame() 尺寸。
审核滑块、开关、按钮、步进器、选择器、分段控件和进度指示器。验证外观与界面匹配,间距看起来自然,控件未被裁剪,交互反馈灵敏。
使用系统颜色(.tint(.blue)、.accentColor)— 它们会自动适应浅色/深色上下文。避免使用可能不适应的硬编码 RGB 值(Color(red:green:blue:))。在两种模式下测试并验证 WCAG AA 对比度比率。
Liquid Glass 元素需要呼吸空间。对玻璃按钮使用默认的 HStack 间距(而不是 spacing: 4)。过度拥挤或玻璃层叠玻璃会产生视觉噪音。当多个玻璃元素必须靠得很近时,使用 GlassEffectContainer。
使用 .scrollEdgeEffectStyle(.hard, for: .top) 来模糊在控件下方滚动的内容。系统栏(工具栏、导航栏、标签栏)会自动采用此效果;自定义栏需要显式设置。
使用 containerRelativeShape() 使控件曲率与容器对齐 — 从控件到表单到窗口再到显示器,创建同心的视觉连续性。
使用内置样式而非自定义玻璃效果:.borderedProminent(主要,配合 .tint() 使用)、.bordered(次要)、.plain + .glassEffect()(三级/自定义)。每种样式都会自动适应 Liquid Glass。
Liquid Glass 应用于定义导航的最顶层。标签栏和侧边栏等关键导航元素浮动在此 Liquid Glass 层中,以帮助用户专注于底层内容。
保持两个不同的层:导航(标签栏、侧边栏、工具栏 — Liquid Glass)浮动在内容(文章、照片、数据 — 无玻璃效果)之上。不要对列表行等内容项应用 .glassEffect() — 内容层上的玻璃效果会模糊边界并与导航竞争。
使用 .tabViewStyle(.sidebarAdaptable)(iOS 26)让标签栏在 iPad/macOS 上适应侧边栏,同时在 iPhone 上保持为标签栏。随着自适应窗口大小流畅过渡。
TabView {
ContentView().tabItem { Label("Home", systemImage: "house") }
SearchView().tabItem { Label("Search", systemImage: "magnifyingglass") }
}
.tabViewStyle(.sidebarAdaptable)
使用带有侧边栏、内容和详情列的 NavigationSplitView。Liquid Glass 会自动应用于侧边栏和检查器。iOS 会调整列的可见性;iPadOS/macOS 在大屏幕上显示所有列。
NavigationSplitView {
List(folders, selection: $selectedFolder) { Label($0.name, systemImage: $0.icon) }
.navigationTitle("Folders")
} content: {
List(items, selection: $selectedItem) { ItemRow($0) }
} detail: {
InspectorView(item: selectedItem)
}
验证内容是否在侧边栏/检查器下方适当透出。当内容需要考虑侧边栏/检查器空间时,使用 .safeAreaInset(edge:)。
当玻璃效果通过 .ignoresSafeArea() 延伸到边缘到边缘时,在内容层使用 .safeAreaPadding()(而不是 .padding())以尊重设备安全区域(刘海、灵动岛、主屏幕指示器):
// ❌ .padding(.horizontal, 20) — 未考虑安全区域
// ✅ .safeAreaPadding(.horizontal, 20) — 超出安全区域 20pt
适用于:带有材质的全屏表单、边缘到边缘工具栏、浮动面板、自定义玻璃导航栏。需要 iOS 17+。有关完整的 .safeAreaPadding() 与 .padding() 指导,请参阅 axiom-swiftui-layout-ref。
验证:内容在侧边栏/检查器下方可见,未被裁剪,透出效果看起来符合预期,与刘海/灵动岛/主屏幕指示器保持适当的缩进。
镜像并模糊侧边栏/检查器下的内容,以获得沉浸式的边缘到边缘感觉,而无需实际在那里滚动内容。最适合英雄图像、照片库和媒体丰富的分割视图。
NavigationSplitView {
SidebarView()
} detail: {
DetailView()
.backgroundExtensionEffect()
}
标签栏可以通过 .tabBarMinimizeBehavior()(iOS 26)在滚动时后退。选项:.onScrollDown(推荐用于阅读/媒体应用)、.onScrollUp、.automatic、.never。向相反方向滚动时标签栏会展开。
菜单在所有平台上都焕然一新。它们采用了 Liquid Glass,并且常见操作的菜单项使用图标来帮助用户快速扫描和识别操作。iPadOS 现在有了菜单栏,以便更快地访问常用命令。
菜单现在在 iOS 和 macOS 上具有一致的布局 — 图标在左侧边缘,相同的 API(Label 或标准控件初始化器)在两个平台上产生相同的视觉效果。
// ✅ 标准选择器自动获得图标
Menu("Actions") {
Button(action: cut) {
Text("Cut")
}
Button(action: copy) {
Text("Copy")
}
Button(action: paste) {
Text("Paste")
}
}
// 系统使用选择器来确定图标
// cut() → 剪刀图标
// copy() → 文档图标
// paste() → 剪贴板图标
cut() → ✂️ 剪刀copy() → 📄 文档paste() → 📋 剪贴板delete() → 🗑️ 垃圾桶share() → ↗️ 分享箭头// ✅ 为自定义操作提供图标
Button {
customAction()
} label: {
Label("Custom Action", systemImage: "star.fill")
}
// ✅ 滑动操作与上下文菜单匹配
List(emails) { email in
EmailRow(email)
.swipeActions(edge: .leading) {
Button("Archive", systemImage: "archivebox") {
archive(email)
}
}
.swipeActions(edge: .trailing) {
Button("Delete", systemImage: "trash", role: .destructive) {
delete(email)
}
}
.contextMenu {
// ✅ 相同的操作出现在顶部
Button("Archive", systemImage: "archivebox") {
archive(email)
}
Button("Delete", systemImage: "trash", role: .destructive) {
delete(email)
}
Divider()
// 下面的附加操作
Button("Mark Unread") { }
}
}
原因 用户期望滑动操作和菜单操作相匹配。一致性建立信任和可预测性。
有关完整的工具栏 API 覆盖范围,请参阅 axiom-swiftui-26-ref:ToolbarSpacer、ToolbarItemGroup 视觉分组、.sharedBackgroundVisibility(.hidden)、工具栏变形、DefaultToolbarItem、用户可自定义工具栏、单色图标渲染、向后兼容的工具栏标签和浮动玻璃按钮。
Liquid Glass 特定的工具栏指导:
.tint() 来传达含义(行动号召、下一步),而不是用于装饰 — 单色减少了 Liquid Glass 下的视觉噪音所有仅图标的按钮都需要 .accessibilityLabel("操作名称"),以供旁白和语音控制用户使用。使用 Label("Share", systemImage: "square.and.arrow.up") 以获得自动的无障碍访问支持。
验证自定义间隔符、项目和可见性与 Liquid Glass 背景是否正常工作。常见问题:在 ToolbarItem 内部有条件地隐藏内容会产生空药丸 — 将 if 移到外部以隐藏整个 ToolbarItem。
窗口采用更圆润的边角以适应控件和导航元素。iPadOS 应用显示窗口控件并支持连续窗口大小调整。表单和操作列表采用 Liquid Glass 并增加了边角半径。
iPadOS 26 窗口可以连续调整大小(没有预设的尺寸过渡)。使用 .windowResizability(.contentSize) 和灵活的布局。移除硬编码的尺寸假设,并在各种窗口大小下测试。
使用 NavigationSplitView(columnVisibility:) 在连续窗口大小调整期间自动重排内容 — 避免手动布局计算和自定义动画代码。
使用 .safeAreaInset(edge:),以便内容自动围绕窗口控件、标题栏和装饰进行调整。
表单增加了边角半径;半高表单从边缘缩进(内容透出),并在过渡到全高时变得更加不透明。检查内容是否未被更圆润的边角裁剪,以及背景透出效果看起来是否符合预期。
从表单中移除 .presentationBackground() — 系统会自动应用 Liquid Glass 表单材质。自定义背景会干扰新材质。
从弹出框和表单中移除自定义的 VisualEffectView/UIBlurEffect 背景。系统会自动应用 Liquid Glass — 不需要背景修饰符。
操作列表现在源自源元素(而不是底部边缘),并允许与界面的其他部分交互。使用附加到触发按钮的 .confirmationDialog() — 系统会自动定位表单。
列表、表格和表单具有更大的行高和内边距,为内容提供呼吸空间。分区具有增加的边角半径以匹配控件的曲率。
列表、表格、表单和分区都增加了高度、内边距、间距和边角半径。标准组件会自动采用。移除硬编码的 .frame(height:) 和 .padding(.vertical:) — 让系统决定行高和内边距。
iOS 26 不再将分区标题大写 — 它们完全按照提供的方式呈现。更新为标题样式大小写:Section(header: Text("User Settings")) 而不是 "user settings"。
使用 .formStyle(.grouped) 以获得自动的行高、内边距、间距和分区边角半径,这些都与各平台的控件相匹配。
平台对于搜索位置和行为的惯例优化了每种设备的体验。审查搜索字段设计惯例以提供引人入胜的搜索体验。
当用户点击搜索字段使其获得焦点时,它会随着键盘的出现而向上滑动。
// ✅ 现有的 searchable 修饰符采用新行为
List(items) { item in
Text(item.name)
}
.searchable(text: $searchText)
对于包含 .tabRole(.search) 的标签页 API 模式,请参阅 swiftui-nav-ref 技能第 5 节(标签页导航集成)。
Liquid Glass 在不同平台、上下文和输入方法下可能具有不同的外观和行为。跨设备测试以了解材质外观。
| 平台 | 采用方式 | 关键要求 |
|---|---|---|
| watchOS | 在最新版本上自动采用,即使没有最新的 SDK | 使用 watchOS 10 的标准工具栏 API 和 .buttonStyle(.bordered) |
| tvOS | 基于焦点 — 当控件获得焦点时出现玻璃效果(Apple TV 4K 第二代+) | 在标准控件上使用 .focusable();对于自定义控件,应用带有 @FocusState 驱动的不透明度的 .glassEffect() |
对于需要反射其后方内容(而不仅仅是在顶部应用玻璃材质)的自定义视图,请使用 .glassBackgroundEffect()。这会创建一个类似玻璃的背景,显示底层内容,与 .glassEffect() 不同,后者将玻璃作为叠加材质应用。
// 具有玻璃背景的自定义浮动面板,反射其后方内容
struct FloatingPanel: View {
var body: some View {
VStack {
Text("Panel Content")
// ...
}
.padding()
.glassBackgroundEffect() // 反射下方内容,而不是顶部
}
}
.glassEffect() 与 .glassBackgroundEffect():对控件和导航元素(按钮、工具栏)使用 .glassEffect()。对应该显示到底层的容器(需要深度的面板、卡片)使用 .glassBackgroundEffect()。
当 Liquid Glass 元素覆盖可滚动内容时,请小心处理裁剪和可见性:
ZStack {
ScrollView {
LazyVStack {
ForEach(items) { item in
ItemRow(item)
}
}
.safeAreaInset(edge: .bottom, spacing: 0) {
Color.clear.frame(height: 80) // 为浮动玻璃控件留出空间
}
}
VStack {
Spacer()
HStack {
Button("Action") { }
.glassEffect()
}
.padding()
}
}
常见问题:玻璃元素可能会在滚动视图边界处被裁剪或失去效果。在滚动内容(而不是玻璃元素)上使用 .clipped(),并确保玻璃元素位于滚动视图的层次结构之外,而不是内部。
| 旧版(iOS 26 之前) | Liquid Glass 等效项 |
|---|---|
UIBlurEffect(style: .systemMaterial) | .glassEffect()(标准) |
UIBlurEffect(style: .systemUltraThinMaterial) | .glassEffect(.clear)(有条件) |
UIBlurEffect(style: .systemChromeMaterial) | 系统工具栏/导航玻璃(自动) |
带有模糊效果的 UIVisualEffectView | 完全移除 — 在 SwiftUI 视图上使用 .glassEffect() |
.background(.thinMaterial) | .glassEffect() 或保留材质(自动适应) |
.background(.ultraThinMaterial) | .glassBackgroundEffect()(用于内容容器) |
自定义 NSVisualEffectView(macOS) | .glassEffect() 或系统组件 |
迁移步骤:(1) 移除 UIVisualEffectView/NSVisualEffectView 包装器,(2) 在 SwiftUI 视图上替换为 .glassEffect(),(3) 使用降低透明度测试以验证备用方案,(4) 分析性能 — 玻璃效果使用 GPU 合成。
将多个 .glassEffect() 视图包装在 GlassEffectContainer { } 中,以优化渲染,启用玻璃形状之间的流畅变形,并减少合成器开销。用于附近的玻璃元素、变形动画和性能关键的界面。
使用 Instruments(时间分析器、SwiftUI、分配、核心动画)分析滚动、动画、内存和 CPU。有关 SwiftUI Instrument 工作流,请参阅 axiom-swiftui-performance;有关 Instruments 决策树,请参阅 axiom-performance-profiling。
在 Info.plist 中添加 UIDesignRequiresCompatibility = true,以便在使用 iOS 26 SDK 构建的同时保持 iOS 18 的外观(禁用 Liquid Glass,使用先前的模糊/材质样式)。迁移策略:启用该键进行发布,在单独的构建中审核更改,逐步更新,准备就绪时移除该键。
glassEffect() - 应用 Liquid Glass 材质glassEffect(.clear) - 透明变体(需要满足 3 个条件)glassEffect(in: Shape) - 自定义形状glassBackgroundEffect() - 用于反射内容的自定义视图scrollEdgeEffectStyle(_:for:) - 在玻璃效果与滚动内容交汇处保持可读性.hard 样式用于固定的辅助视图.soft 样式用于渐变淡出containerRelativeShape() - 使控件形状与容器对齐.borderedProminent 按钮样式.bordered 按钮样式.tint() 的系统颜色以适应变化.tabViewStyle(.sidebarAdaptable) - 标签栏适应侧边栏.tabBarMinimizeBehavior(_:) - 滚动时最小化.tabRole(.search) - 语义搜索标签页NavigationSplitViewToolbarSpacer(.fixed) - 分隔工具栏组.formStyle(.grouped) - 平台优化的表单布局GlassEffectContainer - 组合多个玻璃效果UIDesignRequiresCompatibility(如果需要)在审核应用以采用 Liquid Glass 时使用此清单。按类别分组的 30 个最高影响项目:
presentationBackgroundcontrolSize(.small).borderedProminent/.bordered.sidebarAdaptable).safeAreaPadding().formStyle(.grouped)axiom-swiftui-26-ref)GlassEffectContainerUIDesignRequiresCompatibility 键WWDC : 2025-219, 2025-323(使用新设计构建 SwiftUI 应用)
文档 : /TechnologyOverviews/liquid-glass, /TechnologyOverviews/adopting-liquid-glass, /design/Human-Interface-Guidelines/materials
示例代码 : /SwiftUI/Landmarks-Building-an-app-with-Liquid-Glass
技能 : axiom-liquid-glass, axiom-swiftui-performance, axiom-swiftui-debugging, axiom-accessibility-diag
最后更新 : 2025-12-01 最低平台 : iOS/iPadOS 26, macOS Tahoe, tvOS, watchOS, visionOS 3 Xcode 版本 : Xcode 26+ 技能类型 : 参考(全面的采用指南)
每周安装数
111
代码仓库
GitHub 星标数
610
首次出现
Jan 21, 2026
安全审计
安装于
opencode95
codex89
gemini-cli86
claude-code86
github-copilot82
cursor82
Use when:
axiom-liquid-glass for implementing the Liquid Glass material itself and design review pressure scenariosaxiom-swiftui-performance for profiling Liquid Glass rendering performanceaxiom-accessibility-diag for accessibility testingAdopting Liquid Glass doesn't mean reinventing your app from the ground up. Start by building your app in the latest version of Xcode to see the changes. If your app uses standard components from SwiftUI, UIKit, or AppKit, your interface picks up the latest look and feel automatically on the latest platform releases.
Standard components from SwiftUI, UIKit, and AppKit automatically adopt Liquid Glass with minimal code changes.
// ✅ Standard components get Liquid Glass automatically
NavigationView {
List(items) { item in
Text(item.name)
}
.toolbar {
ToolbarItem {
Button("Add") { }
}
}
}
// Recompile with Xcode 26 → Liquid Glass applied
// ❌ Custom backgrounds interfere with Liquid Glass
NavigationView { }
.background(Color.blue.opacity(0.5)) // Breaks Liquid Glass effects
.toolbar {
ToolbarItem { }
.background(LinearGradient(...)) // Overlays system effects
}
Solution Remove custom effects and let the system determine background appearance.
Liquid Glass adapts to: Reduce Transparency (frostier), Increase Contrast (black/white borders), Reduce Motion (no elastic animations). Verify legibility maintained under each setting and that custom elements provide fallback experiences. For detailed accessibility testing workflows, see axiom-liquid-glass discipline skill.
app.launchArguments += ["-UIAccessibilityIsReduceTransparencyEnabled", "1",
"-UIAccessibilityButtonShapesEnabled", "1", "-UIAccessibilityIsReduceMotionEnabled", "1"]
Liquid Glass brings attention to underlying content. Overusing it on multiple custom controls distracts from content. Apply .glassEffect() only to important functional elements (navigation, primary actions) — not content cards, list rows, or decorative elements.
// ✅ Content layer: no glass. Navigation layer: glass on functional buttons only.
ZStack {
ScrollView { ForEach(articles) { ArticleCard($0) } }
VStack {
Spacer()
HStack {
Button("Filter") { }.glassEffect()
Spacer()
Button("Sort") { }.glassEffect()
}.padding()
}
}
App icons now take on a design that's dynamic and expressive. Updates to the icon grid result in standardized iconography that's visually consistent across devices. App icons contain layers that dynamically respond to lighting and visual effects.
Layered icons: iOS/iPadOS 26+, macOS Tahoe+, watchOS (circular mask). Appearance variants: default (light), dark, clear, tinted (Home Screen personalization).
Design clean, simplified layers with solid fills and semi-transparent overlays. Let the system handle effects (reflection, refraction, shadow, blur, masking). Do NOT bake in pre-applied blur, manual shadows, hardcoded highlights, or fixed masking.
Three layers: foreground (primary elements), middle (supporting), background (foundation). Export each layer as PNG or SVG at @1x/@2x/@3x with transparency preserved.
Included in Xcode 26+ (also standalone from developer.apple.com/design/resources). Drag and drop layers, add optional background, adjust attributes (opacity, position, scale), preview with system effects and all appearance variants, export directly to asset catalog.
Grids: iOS/iPadOS/macOS use rounded rectangle mask; watchOS uses circular mask. Download from developer.apple.com/design/resources. Keep elements centered to avoid clipping, test at all sizes, verify all appearance variants look intentional.
Controls have refreshed look across platforms and come to life during interaction. Knobs transform into Liquid Glass during interaction, buttons fluidly morph into menus/popovers. Hardware shape informs curvature of controls (rounder forms nestle into corners).
Bordered buttons default to capsule shape (mini/small/medium on macOS retain rounded-rectangle). Knobs transform into glass during interaction; buttons morph into menus/popovers. New controlSize(.extraLarge) option; heights slightly taller on macOS. Use controlSize(.small) for backward-compatible high-density layouts. Standard controls adopt automatically — remove hard-coded .frame() dimensions.
Audit sliders, toggles, buttons, steppers, pickers, segmented controls, and progress indicators. Verify appearance matches interface, spacing looks natural, controls aren't cropped, and interaction feedback is responsive.
Use system colors (.tint(.blue), .accentColor) — they adapt to light/dark contexts automatically. Avoid hard-coded RGB values (Color(red:green:blue:)) which may not adapt. Test in both modes and verify WCAG AA contrast ratios.
Liquid Glass elements need breathing room. Use default HStack spacing (not spacing: 4) for glass buttons. Overcrowding or layering glass-on-glass creates visual noise. Use GlassEffectContainer when multiple glass elements must be close together.
Use .scrollEdgeEffectStyle(.hard, for: .top) to obscure content scrolling beneath controls. System bars (toolbars, navigation bars, tab bars) adopt this automatically; custom bars need it explicitly.
Use containerRelativeShape() to align control curvature with containers — creates concentric visual continuity from controls to sheets to windows to display.
Use built-in styles instead of custom glass effects: .borderedProminent (primary, with .tint()), .bordered (secondary), .plain + .glassEffect() (tertiary/custom). Each adapts to Liquid Glass automatically.
Liquid Glass applies to topmost layer where you define navigation. Key navigation elements like tab bars and sidebars float in this Liquid Glass layer to help people focus on underlying content.
Maintain two distinct layers: Navigation (tab bar, sidebar, toolbar — Liquid Glass) floats above Content (articles, photos, data — no glass). Do NOT apply .glassEffect() to content items like list rows — glass on the content layer blurs the boundary and competes with navigation.
Use .tabViewStyle(.sidebarAdaptable) (iOS 26) to let the tab bar adapt to sidebar on iPad/macOS while remaining a tab bar on iPhone. Transitions fluidly with adaptive window sizes.
TabView {
ContentView().tabItem { Label("Home", systemImage: "house") }
SearchView().tabItem { Label("Search", systemImage: "magnifyingglass") }
}
.tabViewStyle(.sidebarAdaptable)
Use NavigationSplitView with sidebar, content, and detail columns. Liquid Glass applies automatically to sidebars and inspectors. iOS adapts column visibility; iPadOS/macOS shows all columns on large screens.
NavigationSplitView {
List(folders, selection: $selectedFolder) { Label($0.name, systemImage: $0.icon) }
.navigationTitle("Folders")
} content: {
List(items, selection: $selectedItem) { ItemRow($0) }
} detail: {
InspectorView(item: selectedItem)
}
Verify content peeks through appropriately beneath sidebars/inspectors. Use .safeAreaInset(edge:) when content needs to account for sidebar/inspector space.
When glass extends edge-to-edge via .ignoresSafeArea(), use .safeAreaPadding() (not .padding()) on the content layer to respect device safe areas (notch, Dynamic Island, home indicator):
// ❌ .padding(.horizontal, 20) — doesn't account for safe areas
// ✅ .safeAreaPadding(.horizontal, 20) — 20pt beyond safe areas
Applies to: full-screen sheets with materials, edge-to-edge toolbars, floating panels, custom glass navigation bars. Requires iOS 17+. See axiom-swiftui-layout-ref for full .safeAreaPadding() vs .padding() guidance.
Verify: content visible beneath sidebar/inspector, not cropped, peek-through looks intentional, properly inset from notch/Dynamic Island/home indicator.
Mirrors and blurs content under sidebar/inspector for an immersive edge-to-edge feel, without actually scrolling content there. Best for hero images, photo galleries, and media-rich split views.
NavigationSplitView {
SidebarView()
} detail: {
DetailView()
.backgroundExtensionEffect()
}
Tab bars can recede when scrolling via .tabBarMinimizeBehavior() (iOS 26). Options: .onScrollDown (recommended for reading/media apps), .onScrollUp, .automatic, .never. Tab bar expands when scrolling in opposite direction.
Menus have refreshed look across platforms. They adopt Liquid Glass, and menu items for common actions use icons to help people quickly scan and identify actions. iPadOS now has menu bar for faster access to common commands.
Menus now have consistent layout across iOS and macOS — icons on leading edge, same API (Label or standard control initializers) produces the same visual result on both platforms.
// ✅ Standard selectors get icons automatically
Menu("Actions") {
Button(action: cut) {
Text("Cut")
}
Button(action: copy) {
Text("Copy")
}
Button(action: paste) {
Text("Paste")
}
}
// System uses selector to determine icon
// cut() → scissors icon
// copy() → documents icon
// paste() → clipboard icon
cut() → ✂️ scissorscopy() → 📄 documentspaste() → 📋 clipboarddelete() → 🗑️ trashshare() → ↗️ share arrow// ✅ Provide icon for custom actions
Button {
customAction()
} label: {
Label("Custom Action", systemImage: "star.fill")
}
// ✅ Swipe actions match contextual menu
List(emails) { email in
EmailRow(email)
.swipeActions(edge: .leading) {
Button("Archive", systemImage: "archivebox") {
archive(email)
}
}
.swipeActions(edge: .trailing) {
Button("Delete", systemImage: "trash", role: .destructive) {
delete(email)
}
}
.contextMenu {
// ✅ Same actions appear at top
Button("Archive", systemImage: "archivebox") {
archive(email)
}
Button("Delete", systemImage: "trash", role: .destructive) {
delete(email)
}
Divider()
// Additional actions below
Button("Mark Unread") { }
}
}
Why Users expect swipe actions and menu actions to match. Consistency builds trust and predictability.
See axiom-swiftui-26-ref for complete toolbar API coverage: ToolbarSpacer, ToolbarItemGroup visual grouping, .sharedBackgroundVisibility(.hidden), toolbar morphing, DefaultToolbarItem, user-customizable toolbars, monochrome icon rendering, backward-compatible toolbar labels, and floating glass buttons.
Liquid Glass-specific toolbar guidance:
.tint() only to convey meaning (call to action, next step), not for decoration — monochrome reduces visual noise under Liquid GlassAll icon-only buttons need .accessibilityLabel("Action Name") for VoiceOver and Voice Control users. Use Label("Share", systemImage: "square.and.arrow.up") to get automatic accessibility support.
Verify custom spacers, items, and visibility work with Liquid Glass backgrounds. Common issue: conditionally hiding content inside ToolbarItem creates empty pills — move the if outside to hide the entire ToolbarItem instead.
Windows adopt rounder corners to fit controls and navigation elements. iPadOS apps show window controls and support continuous window resizing. Sheets and action sheets adopt Liquid Glass with increased corner radius.
iPadOS 26 windows resize continuously (no preset size transitions). Use .windowResizability(.contentSize) and flexible layouts. Remove hard-coded size assumptions and test at various window sizes.
Use NavigationSplitView(columnVisibility:) for automatic content reflow during continuous window resizing — avoids manual layout calculations and custom animation code.
Use .safeAreaInset(edge:) so content automatically adjusts around window controls, title bars, and chrome.
Sheets have increased corner radius; half sheets are inset from edge (content peeks through) and become more opaque when transitioning to full height. Check that content isn't cropped by rounder corners and that background peek-through looks intentional.
Remove .presentationBackground() from sheets — the system applies Liquid Glass sheet material automatically. Custom backgrounds interfere with the new material.
Remove custom VisualEffectView/UIBlurEffect backgrounds from popovers and sheets. The system applies Liquid Glass automatically — no background modifier needed.
Action sheets now originate from the source element (not bottom edge) and allow interaction with other parts of the interface. Use .confirmationDialog() attached to the triggering button — the system positions the sheet automatically.
Lists, tables, and forms have larger row height and padding to give content room to breathe. Sections have increased corner radius to match curvature of controls.
Lists, tables, forms, and sections all have increased height, padding, spacing, and corner radius. Standard components adopt automatically. Remove hard-coded .frame(height:) and .padding(.vertical:) — let the system determine row height and padding.
iOS 26 no longer uppercases section headers — they render exactly as provided. Update to title-style capitalization: Section(header: Text("User Settings")) not "user settings".
Use .formStyle(.grouped) for automatic row height, padding, spacing, and section corner radius that matches controls across platforms.
Platform conventions for search location and behavior optimize experience for each device. Review search field design conventions to provide engaging search experience.
When a person taps search field to give it focus, it slides upwards as keyboard appears.
// ✅ Existing searchable modifier adopts new behavior
List(items) { item in
Text(item.name)
}
.searchable(text: $searchText)
For Tab API patterns including .tabRole(.search), see swiftui-nav-ref skill Section 5 (Tab Navigation Integration).
Liquid Glass can have distinct appearance and behavior across platforms, contexts, and input methods. Test across devices to understand material appearance.
| Platform | Adoption | Key Requirement |
|---|---|---|
| watchOS | Automatic on latest release, even without latest SDK | Use standard toolbar APIs and .buttonStyle(.bordered) from watchOS 10 |
| tvOS | Focus-based — glass appears when controls gain focus (Apple TV 4K 2nd gen+) | Use .focusable() on standard controls; for custom controls, apply .glassEffect() with @FocusState-driven opacity |
For custom views that need to reflect content behind them (not just apply glass material on top), use .glassBackgroundEffect(). This creates a glass-like background that shows through underlying content, distinct from .glassEffect() which applies glass as an overlay material.
// Custom floating panel with glass background reflecting content behind it
struct FloatingPanel: View {
var body: some View {
VStack {
Text("Panel Content")
// ...
}
.padding()
.glassBackgroundEffect() // Reflects content beneath, not on top
}
}
.glassEffect() vs .glassBackgroundEffect(): Use .glassEffect() for controls and navigation elements (buttons, toolbars). Use .glassBackgroundEffect() for content containers that should show through to underlying layers (panels, cards that need depth).
When Liquid Glass elements overlay scrollable content, handle clipping and visibility carefully:
ZStack {
ScrollView {
LazyVStack {
ForEach(items) { item in
ItemRow(item)
}
}
.safeAreaInset(edge: .bottom, spacing: 0) {
Color.clear.frame(height: 80) // Space for floating glass controls
}
}
VStack {
Spacer()
HStack {
Button("Action") { }
.glassEffect()
}
.padding()
}
}
Common issue : Glass elements can clip or lose their effect at scroll view bounds. Use .clipped() on the scroll content (not the glass element) and ensure glass elements are outside the scroll view's hierarchy, not inside it.
| Legacy (Pre-iOS 26) | Liquid Glass Equivalent |
|---|---|
UIBlurEffect(style: .systemMaterial) | .glassEffect() (standard) |
UIBlurEffect(style: .systemUltraThinMaterial) | .glassEffect(.clear) (with conditions) |
UIBlurEffect(style: .systemChromeMaterial) | System toolbar/navigation glass (automatic) |
UIVisualEffectView with blur | Remove entirely — use .glassEffect() on SwiftUI view |
Migration steps : (1) Remove UIVisualEffectView/NSVisualEffectView wrappers, (2) Replace with .glassEffect() on the SwiftUI view, (3) Test with Reduce Transparency to verify fallback, (4) Profile performance — glass effects use GPU compositing.
Wrap multiple .glassEffect() views in GlassEffectContainer { } to optimize rendering, enable fluid morphing between glass shapes, and reduce compositor overhead. Use for nearby glass elements, morphing animations, and performance-critical interfaces.
Profile scrolling, animations, memory, and CPU with Instruments (Time Profiler, SwiftUI, Allocations, Core Animation). See axiom-swiftui-performance for SwiftUI Instrument workflows and axiom-performance-profiling for Instruments decision trees.
Add UIDesignRequiresCompatibility = true to Info.plist to ship with iOS 26 SDK while maintaining iOS 18 appearance (Liquid Glass disabled, previous blur/material styles used). Migration strategy: ship with key enabled, audit changes in separate build, update incrementally, remove key when ready.
glassEffect() - Apply Liquid Glass materialglassEffect(.clear) - Clear variant (requires 3 conditions)glassEffect(in: Shape) - Custom shapeglassBackgroundEffect() - For custom views reflecting contentscrollEdgeEffectStyle(_:for:) - Maintain legibility where glass meets scrolling content.hard style for pinned accessory views.soft style for gradual fadecontainerRelativeShape() - Align control shapes with containers.borderedProminent button style.bordered button style.tint() for adaptation.tabViewStyle(.sidebarAdaptable) - Tab bar adapts to sidebar.tabBarMinimizeBehavior(_:) - Minimize on scroll.tabRole(.search) - Semantic search tabsNavigationSplitView for sidebar + inspector layoutsToolbarSpacer(.fixed) - Separate toolbar groups.formStyle(.grouped) - Platform-optimized form layoutsGlassEffectContainer - Combine multiple glass effectsUIDesignRequiresCompatibility in Info.plist (if needed)Use this checklist when auditing app for Liquid Glass adoption. 30 highest-impact items grouped by category:
presentationBackground removed from sheets and popoverscontrolSize(.small) for high-density layouts.borderedProminent/.bordered adopted.sidebarAdaptable).safeAreaPadding() for edge-to-edge glass.formStyle(.grouped) adopted for formsaxiom-swiftui-26-ref)GlassEffectContainer used for multiple nearby glass effectsUIDesignRequiresCompatibility key considered if neededWWDC : 2025-219, 2025-323 (Build a SwiftUI app with the new design)
Docs : /TechnologyOverviews/liquid-glass, /TechnologyOverviews/adopting-liquid-glass, /design/Human-Interface-Guidelines/materials
Sample Code : /SwiftUI/Landmarks-Building-an-app-with-Liquid-Glass
Skills : axiom-liquid-glass, axiom-swiftui-performance, axiom-swiftui-debugging, axiom-accessibility-diag
Last Updated : 2025-12-01 Minimum Platform : iOS/iPadOS 26, macOS Tahoe, tvOS, watchOS, visionOS 3 Xcode Version : Xcode 26+ Skill Type : Reference (comprehensive adoption guide)
Weekly Installs
111
Repository
GitHub Stars
610
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode95
codex89
gemini-cli86
claude-code86
github-copilot82
cursor82
Flutter布局指南:构建响应式UI的约束规则与自适应设计模式
1,200 周安装
.background(.thinMaterial) | .glassEffect() or keep material (adapts automatically) |
.background(.ultraThinMaterial) | .glassBackgroundEffect() for content containers |
Custom NSVisualEffectView (macOS) | .glassEffect() or system components |