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
累計下載
4809
星標
16
全站排名
#1,957
全站前 39% · 「開發程式設計」前 44%
平台累計安裝累計下載星標評論
ClawHub ↗149454116-
SkillHub ↗590480916—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

用來實現、評審或改造採用 Liquid Glass 的 SwiftUI 功能,優先用原生介面與玻璃按鈕樣式,而不是自己拼視覺。會檢查該用與不該用的位置、修飾符順序、形狀與容器層級,以及可用性判斷與降級方案。互動式玻璃只給可點選或可聚焦元素加,形變過渡只在檢視層級變化時加。這是面向需要 Liquid Glass 的請求的文件指引;若一般 Apple 設計任務不應套用這套指引,應明確說明。

資料釋出於 2026-10-27

可以用來做什麼

  • 把舊介面改造成 Liquid Glass 風格
  • 評審一處玻璃效果的修飾符順序

什麼時候用

  • 新介面要上 Liquid Glass 時
  • 懷疑玻璃層級用錯時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

幫我把這個 SwiftUI 頁面改成 Liquid Glass 風格
檢查這段玻璃效果的修飾符順序對不對

月度資料趨勢

累計下載4809
3402415849132026-03 · 累計下載 35062026-05 · 累計下載 37992026-06 · 累計下載 39432026-07 · 累計下載 42372026-08 · 累計下載 44052026-09 · 累計下載 480926-0326-09
星標16
1415162026-03 · 星標 142026-05 · 星標 152026-06 · 星標 162026-07 · 星標 162026-08 · 星標 162026-09 · 星標 1626-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-094809—16
2026-084405+4.0%16
2026-074237+7.5%16
2026-063943+3.8%16
2026-053799—15
2026-033506—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),按月更新。口徑說明見資料方法。