跳到正文
Skillpedia
网站与界面(前端)48k · #5912

swiftui-liquid-glass

它能做什么

这个工具可以帮你创建或审查移动应用中使用“Liquid Glass”视觉效果的部分。这种效果会让屏幕上的元素呈现出现代的磨砂玻璃外观。

适用场景

  • ✓你希望应用拥有现代、简洁的外观时。
  • ✓需要创建在视觉上格外醒目的按钮或区域时。
  • ✓想确保玻璃效果在不同操作系统版本上都能正常显示时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-liquid-glass/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-liquid-glass/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“创建一个玻璃效果按钮,点击时会变色。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会使用特定的系统命令来应用玻璃效果。它还会检查该效果是否兼容较旧的系统版本,并在不兼容时提供视觉上的替代方案。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

SwiftUI Liquid Glass

Overview

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.

When to Use

  • When the user wants to adopt or review Liquid Glass in SwiftUI UI.
  • When you need correct API usage, fallback handling, or modifier ordering for Liquid Glass.

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.

if #available(iOS 26, *) {
    Text("Hello")
        .padding()
        .glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
    Text("Hello")
        .padding()
        .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}
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()
    }
}
Button("Confirm") { }
    .buttonStyle(.glassProminent)

Resources

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

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题

什么是“Liquid Glass”?

它是应用的一种视觉特效,能模拟磨砂玻璃的质感,为设计增添现代而精致的感觉。

我需要会编程才能使用吗?

不需要。你只需描述想要的效果,工具(或使用它的 AI)就会处理具体的技术细节来实现。

这个效果在所有手机上都能用吗?

该工具的目标是确保效果在较新的系统版本(iOS 26+)上正常运行,并为旧版本提供视觉替代方案,让应用保持一致的外观。

详情

作者的原始描述

Implement or review SwiftUI Liquid Glass APIs with correct fallbacks and modifier order.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5912
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能