帮助开发者与设计师实现 iOS 液态玻璃动态界面与交互效果。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "liquid-glass-design" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/liquid-glass-design/SKILL.md 2. 保存为 ~/.claude/skills/liquid-glass-design/SKILL.md 3. 装好后重载技能,告诉我可以用了
请用 SwiftUI 创建一个 iOS 26 Liquid Glass 风格的信息卡片,包含背景模糊、边缘高光、轻微反射效果,以及点击时的形变动画,并附上可运行代码。
输出一段可运行的 SwiftUI 代码,实现液态玻璃卡片的视觉与交互动效。
请为 UIKit 设计一个 Liquid Glass 风格导航栏方案,说明如何实现半透明玻璃材质、滚动时反射变化,以及与浅色/深色模式的适配,并提供示例代码。
给出 UIKit 实现思路、关键样式说明,以及可参考的示例代码。
请为 WidgetKit 生成一个液态玻璃风格的小组件设计方案,包含层次结构、模糊与高光建议、内容排版原则,以及对应的 SwiftUI 组件代码。
输出小组件的视觉规范说明与对应代码,便于直接制作原型或开发。
Patterns for implementing Apple's Liquid Glass — a dynamic material that blurs content behind it, reflects color and light from surrounding content, and reacts to touch and pointer interactions. Covers SwiftUI, UIKit, and WidgetKit integration.
The simplest way to add Liquid Glass to any view:
Text("Hello, World!")
.font(.title)
.padding()
.glassEffect() // Default: regular variant, capsule shape
Text("Hello, World!")
.font(.title)
.padding()
.glassEffect(.regular.tint(.orange).interactive(), in: .rect(cornerRadius: 16.0))
Key customization options:
.regular — standard glass effect.tint(Color) — add color tint for prominence.interactive().capsule (default), .rect(cornerRadius:), .circleButton("Click Me") { /* action */ }
.buttonStyle(.glass)
Button("Important") { /* action */ }
.buttonStyle(.glassProminent)
Always wrap multiple glass views in a container for performance and morphing:
GlassEffectContainer(spacing: 40.0) {
HStack(spacing: 40.0) {
Image(systemName: "scribble.variable")
.frame(width: 80.0, height: 80.0)
.font(.system(size: 36))
.glassEffect()
Image(systemName: "eraser.fill")
.frame(width: 80.0, height: 80.0)
.font(.system(size: 36))
.glassEffect()
}
}
The spacing parameter controls merge distance — closer elements blend their glass shapes together.
Combine multiple views into a single glass shape with glassEffectUnion:
@Namespace private var namespace
GlassEffectContainer(spacing: 20.0) {
HStack(spacing: 20.0) {
ForEach(symbolSet.indices, id: \.self) { item in
Image(systemName: symbolSet[item])
.frame(width: 80.0, height: 80.0)
.glassEffect()
.glassEffectUnion(id: item < 2 ? "group1" : "group2", namespace: namespace)
}
}
}
Create smooth morphing when glass elements appear/disappear:
@State private var isExpanded = false
@Namespace private var namespace
GlassEffectContainer(spacing: 40.0) {
HStack(spacing: 40.0) {
Image(systemName: "scribble.variable")
.frame(width: 80.0, height: 80.0)
.glassEffect()
.glassEffectID("pencil", in: namespace)
if isExpanded {
Image(systemName: "eraser.fill")
.frame(width: 80.0, height: 80.0)
.glassEffect()
.glassEffectID("eraser", in: namespace)
}
}
}
Button("Toggle") {
withAnimation { isExpanded.toggle() }
}
.buttonStyle(.glass)
To allow horizontal scroll content to extend under a sidebar or inspector, ensure the ScrollView content reaches the leading/trailing edges of the container. The system automatically handles the under-sidebar scrolling behavior when the layout extends to the edges — no additional modifier is needed.
let glassEffect = UIGlassEffect()
glassEffect.tintColor = UIColor.systemBlue.withAlphaComponent(0.3)
glassEffect.isInteractive = true
let visualEffectView = UIVisualEffectView(effect: glassEffect)
visualEffectView.translatesAutoresizingMaskIntoConstraints = false
…
通过双评审智能体对结果进行对抗式校验,提升输出发布前的可靠性