Chuyển đến nội dung
Skillpedia
Ứng dụng di động7.4k · #13249

swiftui-liquid-glass

Skill này làm gì

Skill này hướng dẫn cách dùng các hiệu ứng thiết kế kính của Apple trong SwiftUI, để xây dựng, cải thiện hoặc rà soát một tính năng. Dành cho lập trình viên iOS đang áp dụng giao diện Liquid Glass mới hơn.

Khi nào nên dùng

  • ✓Khi bạn muốn một màn hình SwiftUI dùng phong cách Liquid Glass.
  • ✓Khi bạn muốn một tính năng hiện có được rà soát về cách dùng hiệu ứng kính đúng.
  • ✓Khi bạn cần xử lý các phiên bản iOS cũ hơn cùng với hiệu ứng kính.

Liên kết skill

https://github.com/steipete/agent-scripts/blob/main/skills/swiftui-liquid-glass/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/steipete/agent-scripts/blob/main/skills/swiftui-liquid-glass/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Cập nhật thanh công cụ SwiftUI này để dùng kiểu Liquid Glass, với phương án dự phòng cho các phiên bản iOS cũ hơn.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent dùng các hiệu ứng kính và container gốc, thêm chúng vào các phần tử có thể chạm khi hữu ích, và kiểm tra tính khả dụng trên iOS 26 trở lên với các phương án dự phòng hợp lý.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

SwiftUI Liquid Glass

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

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.

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.
Câu hỏi thường gặp

Có nên dùng hiệu ứng mờ tùy chỉnh thay thế không?

Không. Skill nói nên ưu tiên các API Liquid Glass gốc thay vì hiệu ứng mờ tự làm.

Nó nhắm đến những thiết bị nào?

iOS 26 trở lên, với xử lý dự phòng cho các phiên bản cũ hơn.

Hiệu ứng kính được áp dụng ở đâu?

Sau các modifier bố cục và giao diện, và được nhóm trong một container khi có nhiều hiệu ứng xuất hiện.

Chi tiết

Mô tả gốc của tác giả

SwiftUI Liquid Glass: implement, adopt, refactor, review correctness/perf/design.

repo: steipete/agent-scripts

Độ phổ biến

Sao GitHub
7.4k
Vị trí xếp hạng
#13249
Giấy phép
MIT
Cập nhật
30/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự