swiftui-debugging

Diagnose SwiftUI view update failures using Self._printChanges() and decision trees.

1.1k|81|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/CharlesWiltgen/Axiom --skill swiftui-debugging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-debugging
Source: https://github.com/CharlesWiltgen/Axiom/tree/main/.claude-plugin/plugins/axiom/skills/swiftui-debugging
Command: npx skills add https://github.com/CharlesWiltgen/Axiom --skill swiftui-debugging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Diagnostics for SwiftUI view updates, previews, and layout issues with a structured debugging approach.

Core Features & Use Cases

  • Self._printChanges() debugging tool patterns
  • View identity, state updates, and layout debugging
  • Cross-reference with performance and concurrency patterns

Quick Start

Prompt: "Investigate why a SwiftUI view doesn't update after a state change."

Frequently Asked Questions about swiftui-debugging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why isn't my SwiftUI view updating after a state change?

SwiftUI view updates fail when identity or state bindings are incorrect. Use Self._printChanges() to log what SwiftUI is tracking, verify @State and @ObservedObject are declared at the right scope, and check that your state mutations trigger view recomputation. Cross-reference with performance patterns to rule out expensive computations blocking updates.

How do I debug SwiftUI preview crashes?

Preview crashes occur from environment setup, dependency injection, or preview-specific code paths. Isolate the crash by simplifying the preview container, verify all @Environment values are provided, check that preview dependencies match runtime ones, and use minimal preview steps. Stable environment checks catch most preview crashes early.

What causes layout issues in SwiftUI and how do I fix them?

Layout breaks stem from view identity shifts, conflicting frame modifiers, or state-driven layout logic. Debug by inspecting view hierarchy with Xcode's preview canvas, apply stable identities to list items and conditional views, and use diagnostic decision trees to trace layout recalculation. Self._printChanges() reveals unexpected redraws causing layout instability.

How do I use Self._printChanges() for SwiftUI debugging?

Self._printChanges() logs which properties triggered view recomputation during struct updates. Call it in your view body to see exactly which @State, @Binding, or @EnvironmentObject changes fired—identify over-rendering and unnecessary redraws. This tool pinpoints state mutation paths that shouldn't trigger updates.

Do I need to understand concurrency to debug SwiftUI view updates?

Concurrency affects view updates when state mutations happen off the main thread or async operations race with view redraws. SwiftUI debugging covers dependency checks and environment stability; cross-reference with concurrency patterns to diagnose MainActor issues and state synchronization problems causing update failures.