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.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
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
GlassEffectContainerwhere 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
GlassEffectContainerwhen 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:
glassEffectapplied after layout/appearance modifiers. - Interactivity:
interactive()only where user interaction exists. - Transitions:
glassEffectIDused with@Namespacefor morphing. - Consistency: Shapes, tinting, and spacing align across the feature.
Implementation Checklist
- Define target elements and desired glass prominence.
- Wrap grouped glass elements in
GlassEffectContainerand tune spacing. - Use
.glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...))as needed. - Use
.buttonStyle(.glass)/.buttonStyle(.glassProminent)for actions. - Add morphing transitions with
glassEffectIDwhen 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
Bình luận
- …
Thêm skill từ kho mã này
beeper
7.4kGiúp agent của bạn tìm trong lịch sử chat Beeper cục bộ để tìm tin nhắn và xác định chat hoặc liên hệ nào mà một gợi ý mơ hồ đang nhắc đến.
cloudflare-registrar
7.4kGiúp agent của bạn kiểm tra giá và tình trạng khả dụng của tên miền trên Cloudflare Registrar, và đăng ký hoặc liệt kê tên miền với bước xác nhận.
codexbar
7.4kGiúp agent của bạn kiểm tra còn bao nhiêu hạn mức sử dụng các dịch vụ AI như Codex, Claude và Kimi, gồm giới hạn, tín dụng và thời gian đặt lại.
create-cli
7.4kGiúp agent của bạn thiết kế lệnh, cờ, văn bản trợ giúp, đầu ra và lỗi của một công cụ dòng lệnh, để nó hoạt động tốt cho cả người lẫn script.
Skill tương tự
android-clean-architecture
280kGiúp agent của bạn tổ chức dự án Android hiệu quả, cấu trúc code để việc bảo trì và phát triển tính năng mới dễ dàng hơn.
compose-multiplatform-patterns
280kGiúp agent của bạn dùng các mẫu Compose Multiplatform và Jetpack Compose trong dự án KMP, gồm trạng thái, điều hướng, giao diện và hiệu năng.
dart-flutter-patterns
280kGiúp agent của bạn viết code cho ứng dụng Dart và Flutter. Agent dùng các mẫu hiện đại để tạo ứng dụng vững chắc và dễ quản lý.