Peter Steinberger

Swiftui Liquid Glass

开发编程v1.0.0
作者:Peter Steinberger更新于 2026-05-11swiftui-liquid-glass@clawhub_steipete/swiftui-liquid-glass
前端开发

据 AlphaMoat 统计,截至 2026-09,Swiftui Liquid Glass 累计下载 4,809 次、获 16 个星标,在全部 5,078 个 AI 技能中排名第 1,957 位,在「开发编程」分类(577 个)中排名第 252 位。

累计安装
590
累计下载
4,809
星标
16
全站排名
#1,957
全站前 39% · 「开发编程」前 44%
平台累计安装累计下载星标评论
ClawHub ↗1494,54116-
SkillHub ↗5904,80916—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

用来实现、评审或改造采用 Liquid Glass 的 SwiftUI 功能,优先用原生接口与玻璃按钮样式,而不是自己拼视觉。会检查该用与不该用的位置、修饰符顺序、形状与容器层级,以及可用性判断与降级方案。交互式玻璃只给可点击或可聚焦元素加,形变过渡只在视图层级变化时加。这是面向需要 Liquid Glass 的请求的文档指导;若一般 Apple 设计任务不应套用这套指导,应明确说明。

资料发布于 2026-10-27

可以用来做什么

  • 把旧界面改造成 Liquid Glass 风格
  • 评审一处玻璃效果的修饰符顺序

什么时候用

  • 新界面要上 Liquid Glass 时
  • 怀疑玻璃层级用错时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

帮我把这个 SwiftUI 页面改成 Liquid Glass 风格
检查这段玻璃效果的修饰符顺序对不对

月度数据趋势

累计下载4,809
3,4024,1584,9132026-03 · 累计下载 3,5062026-05 · 累计下载 3,7992026-06 · 累计下载 3,9432026-07 · 累计下载 4,2372026-08 · 累计下载 4,4052026-09 · 累计下载 4,80926-0326-09
星标16
1415162026-03 · 星标 142026-05 · 星标 152026-06 · 星标 162026-07 · 星标 162026-08 · 星标 162026-09 · 星标 1626-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,809—16
2026-084,405+4.0%16
2026-074,237+7.5%16
2026-063,943+3.8%16
2026-053,799—15
2026-033,506—14

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

3.7 KB · ClawHub v1.0.0
---
name: swiftui-liquid-glass
description: Implement, review, or improve SwiftUI features using the iOS 26+ Liquid Glass API. Use when asked to adopt Liquid Glass in new SwiftUI UI, refactor an existing feature to Liquid Glass, or review Liquid Glass usage for correctness, performance, and design alignment.
---

# SwiftUI Liquid Glass

_Attribution: copied from @Dimillian’s `Dimillian/Skills` (2025-12-31)._

## Overview
展开全部(共 93 行)
Use this skill to build or review SwiftUI features that fully align with the iOS 26+ Liquid Glass API. Prioritize native APIs (`glassEffect`, `GlassEffectContainer`, glass button styles) and Apple design guidance. Keep usage consistent, interactive where needed, and performance aware.

## Workflow Decision Tree
Choose the path that matches the request:

### 1) Review an existing feature
- Inspect where Liquid Glass should be used and where it should not.
- Verify correct modifier order, shape usage, and container placement.
- Check for iOS 26+ availability handling and sensible fallbacks.

### 2) Improve a feature using Liquid Glass
- Identify target components for glass treatment (surfaces, chips, buttons, cards).
- Refactor to use `GlassEffectContainer` where multiple glass elements appear.
- Introduce interactive glass only for tappable or focusable elements.

### 3) Implement a new feature using Liquid Glass
- Design the glass surfaces and interactions first (shape, prominence, grouping).
- Add glass modifiers after layout/appearance modifiers.
- Add morphing transitions only when the view hierarchy changes with animation.

## Core Guidelines
- Prefer native Liquid Glass APIs over custom blurs.
- Use `GlassEffectContainer` when multiple glass elements coexist.
- Apply `.glassEffect(...)` after layout and visual modifiers.
- Use `.interactive()` for elements that respond to touch/pointer.
- Keep shapes consistent across related elements for a cohesive look.
- Gate with `#available(iOS 26, *)` and provide a non-glass fallback.

## Review Checklist
- **Availability**: `#available(iOS 26, *)` present with fallback UI.
- **Composition**: Multiple glass views wrapped in `GlassEffectContainer`.
- **Modifier order**: `glassEffect` applied after layout/appearance modifiers.
- **Interactivity**: `interactive()` only where user interaction exists.
- **Transitions**: `glassEffectID` used with `@Namespace` for morphing.
- **Consistency**: Shapes, tinting, and spacing align across the feature.

## Implementation Checklist
- Define target elements and desired glass prominence.
- Wrap grouped glass elements in `GlassEffectContainer` and tune spacing.
- Use `.glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...))` as needed.
- Use `.buttonStyle(.glass)` / `.buttonStyle(.glassProminent)` for actions.
- Add morphing transitions with `glassEffectID` when hierarchy changes.
- Provide fallback materials and visuals for earlier iOS versions.

## Quick Snippets
Use these patterns directly and tailor shapes/tints/spacing.

```swift
if #available(iOS 26, *) {
    Text("Hello")
        .padding()
        .glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
    Text("Hello")
        .padding()
        .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}
```

```swift
GlassEffectContainer(spacing: 24) {
    HStack(spacing: 24) {
        Image(systemName: "scribble.variable")
            .frame(width: 72, height: 72)
            .font(.system(size: 32))
            .glassEffect()
        Image(systemName: "eraser.fill")
            .frame(width: 72, height: 72)
            .font(.system(size: 32))
            .glassEffect()
    }
}
```

```swift
Button("Confirm") { }
    .buttonStyle(.glassProminent)
```

## Resources
- Reference guide: `references/liquid-glass.md`
- Prefer Apple docs for up-to-date API details.

「开发编程」分类下的热门技能

Peter Steinberger 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。