Communitygithub.com

SwiftUI Liquid Glass 技能

實作、審查或改進使用 iOS 26+ Liquid Glass API 的 SwiftUI 功能。在需要將 Liquid Glass 應用於新的 SwiftUI UI、重構現有功能或審查 Liquid Glass 使用正確性、效能與設計一致性時使用。

SwiftUI Liquid Glass 技能 是什麼?

此技能專為開發者設計,協助其在 SwiftUI 專案中應用 iOS 26+ 的 Liquid Glass API。它提供清晰的指引,包括如何審查現有功能是否正確使用 Liquid Glass、如何改進現有程式碼以採用此 API,以及如何從頭實作新的玻璃風格 UI。技能文件包含決策流程、核心準則(如優先使用原生 API、正確的修飾器順序、容器放置),以及詳細的審查與實作檢查清單。此外,還提供可直接複製貼上的 Swift 程式碼片段,展示玻璃效果、互動式玻璃、容器用法與按鈕樣式。此技能支援所有使用 SwiftUI 的開發平台(iOS 26+),並強調透過 `#available` 進行版本控管,確保向下相容性。開發者可以依此技能確保 Liquid Glass 使用的一致、高效能且符合 Apple 設計理念。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/dimillian/swiftui-liquid-glass

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

SwiftUI Liquid Glass

概觀

使用此技能來建置或審查完全符合 iOS 26+ Liquid Glass API 的 SwiftUI 功能。優先使用原生 API(glassEffect、GlassEffectContainer、玻璃按鈕樣式)以及 Apple 的設計指引。保持使用一致、在需要時加入互動性,並注意效能。

工作流程決策樹

根據請求類型選擇對應路徑:

1) 審查現有功能

  • 檢查 Liquid Glass 應該使用與不該使用的地方。
  • 驗證修飾器順序、形狀使用與容器放置是否正確。
  • 確認 iOS 26+ 的可使用性處理以及合理的降級方案。

2) 使用 Liquid Glass 改進功能

  • 識別適合玻璃效果的目標元件(表面、晶片、按鈕、卡片)。
  • 當有多個玻璃元素出現時,重構為使用 GlassEffectContainer。
  • 僅對可點擊或可聚焦的元素加入互動式玻璃效果。

3) 使用 Liquid Glass 實作新功能

  • 首先設計玻璃表面與互動方式(形狀、突出程度、群組)。
  • 在佈局/外觀修飾器之後加入玻璃修飾器。
  • 僅在視圖層級因動畫而改變時加入變形轉場。

核心準則

  • 優先使用原生 Liquid Glass API,而非自訂模糊效果。
  • 當多個玻璃元素共存時使用 GlassEffectContainer。
  • 在佈局與視覺修飾器之後套用 .glassEffect(...)。
  • 對會回應觸碰/指標的元素使用 .interactive()。
  • 保持相關元素間的形狀一致,以達到統一外觀。
  • 使用 #available(iOS 26, *) 進行版本控管,並提供非玻璃的降級方案。

審查檢查清單

  • 可用性:存在 #available(iOS 26, *) 並附有降級 UI。
  • 組成結構:多個玻璃視圖被包裝在 GlassEffectContainer 中。
  • 修飾器順序:glassEffect 在佈局/外觀修飾器之後套用。
  • 互動性:interactive() 僅用於有使用者互動的元素。
  • 轉場:使用 glassEffectID 搭配 @Namespace 進行變形轉場。
  • 一致性:形狀、色調與間距在功能中各處保持一致。

實作檢查清單

  • 定義目標元素與所需的玻璃突出程度。
  • 將群組玻璃元素包裝在 GlassEffectContainer 中並調整間距。
  • 根據需要使用 .glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...))。
  • 對動作按鈕使用 .buttonStyle(.glass) / .buttonStyle(.glassProminent)。
  • 當視圖層級改變時,使用 glassEffectID 加入變形轉場。
  • 為較舊的 iOS 版本提供降級素材與視覺效果。

快速程式碼片段

直接使用這些模式,並根據需求調整形狀、色調與間距。

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("確認") { }
    .buttonStyle(.glassProminent)

參考資源

  • 參考指南:references/liquid-glass.md
  • 推薦查閱 Apple 官方文件以取得最新 API 細節。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相關技能