---
name: macos-liquid-glass
description: Build modern macOS 26 (Tahoe) desktop interfaces in SwiftUI using the Liquid Glass design language, GlassEffectContainer, ToolbarSpacer, and native desktop layouts. Use whenever creating, redesigning, or polishing macOS SwiftUI views, toolbars, floating controls, or window architectures.
---

# macOS 26 Liquid Glass SwiftUI Skill

## Core Design Principles

1. **Strict Layer Separation**: Liquid Glass is **only** for the floating navigation and control layer (toolbars, floating bars, HUDs, key action buttons). **Never** apply `.glassEffect()` to content layers (lists, tables, text editors, media, or full-screen backgrounds).
2. **System Controls First**: Prefer standard SwiftUI desktop containers (`NavigationSplitView`, `.toolbar`, `.inspector`, `.searchable`) — they automatically adopt Liquid Glass on macOS 26 without manual styling.
3. **No Glass-on-Glass**: Never nest a `.glassEffect()` view inside another `.glassEffect()` view.
4. **Always Batch with `GlassEffectContainer`**: Multiple adjacent or morphing glass elements must share a `GlassEffectContainer` to combine offscreen rendering passes (`CABackdropLayer`) and enable fluid morphing.
5. **Respect Accessibility Automatically**: Do not override Reduce Transparency, Increased Contrast, or Tinted Mode manually; rely on system `.glassEffect()` defaults.

## API Quick Reference (macOS 26+)

### 1. Custom Glass Views
```swift
// Signature: .glassEffect(_ glass: Glass = .regular, in shape: S = DefaultGlassEffectShape, isEnabled: Bool = true)
Text("Status")
    .padding(.horizontal, 12)
    .padding(.vertical, 6)
    .glassEffect(.regular, in: .capsule)

// Interactive + semantic tint
Button("Deploy") { }
    .padding(.horizontal, 14)
    .padding(.vertical, 8)
    .glassEffect(.regular.tint(.blue).interactive(), in: .capsule)
```
* Variants: `.regular` (default), `.clear` (over rich media), `.identity` (disable effect while keeping layout).
* Chain `.interactive()` on custom clickable views for hover/press scale and shimmer feedback.

### 2. Glass Buttons
Use built-in styles instead of manually styling standard `Button`s:
```swift
Button("Cancel") { }
    .buttonStyle(.glass)

Button("Save") { }
    .buttonStyle(.glassProminent)
    .tint(.accentColor)
```

### 3. Container, Morphing & Union
```swift
struct FloatingActionBar: View {
    @Namespace private var glassNS
    @State private var isExpanded = false

    var body: some View {
        GlassEffectContainer(spacing: 16) {
            HStack(spacing: 12) {
                Button {
                    withAnimation(.smooth) { isExpanded.toggle() }
                } label: {
                    Image(systemName: isExpanded ? "xmark" : "plus")
                }
                .buttonStyle(.glass)
                .glassEffectID("toggle", in: glassNS)

                if isExpanded {
                    Button("New Note") { }
                        .buttonStyle(.glass)
                        .glassEffectID("newNote", in: glassNS)
                }
            }
        }
    }
}
```
* Use `.glassEffectID(_:in:)` **only** when morphing transitions are needed (adds CPU overhead).
* Use `.glassEffectUnion(id:namespace:)` when distant glass elements must visually merge into one continuous shape.

### 4. Modern macOS Toolbars & Bars
* Use `ToolbarItemGroup` to group related actions into unified glass capsules.
* Use `ToolbarSpacer(.fixed)` or `ToolbarSpacer(.flexible)` to separate toolbar groups cleanly.
* Use `.safeAreaBar(edge: .bottom)` for floating bottom control bars over scrollable content instead of manual `ZStack` overlays.

### 5. Native Desktop Layout Skeleton
```swift
struct AppRootView: View {
    @State private var showInspector = false

    var body: some View {
        NavigationSplitView {
            SidebarView()
                .navigationSplitViewColumnWidth(min: 200, ideal: 240)
        } detail: {
            ContentDetailView()
                .inspector(isPresented: $showInspector) {
                    InspectorView()
                        .inspectorColumnWidth(min: 240, ideal: 280)
                }
                .toolbar {
                    ToolbarItemGroup(placement: .primaryAction) {
                        Button("Run", systemImage: "play.fill") { }
                    }
                    ToolbarSpacer(.fixed)
                    ToolbarItem(placement: .primaryAction) {
                        Button("Inspector", systemImage: "sidebar.right") {
                            showInspector.toggle()
                        }
                    }
                }
        }
    }
}
```

## Anti-Patterns to Reject

* Applying `.ultraThinMaterial` / `.regularMaterial` to floating controls when targeting macOS 26+ (use `.glassEffect()` or `.buttonStyle(.glass)` instead).
* Putting `.glassEffect()` on `List` rows, `Table` cells, or `ScrollView` backgrounds.
* Placing 3+ sibling `.glassEffect()` views in an `HStack`/`VStack` without wrapping them in `GlassEffectContainer`.
* Adding `.glassEffectID` to static views that never animate or morph.
* Bridging `NSVisualEffectView` via `NSViewRepresentable` for standard glass chrome.

## Pre-Delivery Checklist

Before finalizing SwiftUI code, verify:
- [ ] Deployment target / `#available(macOS 26.0, *)` guard is handled if supporting older macOS versions.
- [ ] Content views remain flat, opaque, and legible; only chrome/controls use Liquid Glass.
- [ ] All grouped glass elements are wrapped in `GlassEffectContainer`.
- [ ] Standard buttons use `.buttonStyle(.glass)` / `.buttonStyle(.glassProminent)` rather than custom background hacks.