Confirm successful installation by checking the skill directory location:
.cursor/skills/axiom-swiftui-debugging
Restart Cursor to activate axiom-swiftui-debugging. Access via /axiom-swiftui-debugging in your agent's command palette.
โ
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
SwiftUI debugging falls into three categories, each with a different diagnostic approach:
View Not Updating โ You changed something but the view didn't redraw. Decision tree to identify whether it's struct mutation, lost binding identity, accidental view recreation, or missing observer pattern.
Preview Crashes โ Your preview won't compile or crashes immediately. Decision tree to distinguish between missing dependencies, state initialization failures, and Xcode cache corruption.
Layout Issues โ Views appearing in wrong positions, wrong sizes, overlapping unexpectedly. Quick reference patterns for common scenarios.
Core principle: Start with observable symptoms, test systematically, eliminate causes one by one. Don't guess.
Requires: Xcode 26+, iOS 17+ (iOS 14-16 patterns still valid, see notes)
Related skills: axiom-xcode-debugging (cache corruption diagnosis), axiom-swift-concurrency (observer patterns), axiom-swiftui-performance (profiling with Instruments), axiom-swiftui-layout (adaptive layout patterns)
Example Prompts
These are real questions developers ask that this skill is designed to answer:
1. "My list item doesn't update when I tap the favorite button, even though the data changed"
โ The skill walks through the decision tree to identify struct mutation vs lost binding vs missing observer
2. "Preview crashes with 'Cannot find AppModel in scope' but it compiles fine"
โ The skill shows how to provide missing dependencies with .environment() or .environmentObject()
3. "My counter resets to 0 every time I toggle a boolean, why?"
โ The skill identifies accidental view recreation from conditionals and shows .opacity() fix
4. "I'm using @Observable but the view still doesn't update when I change the property"
โ The skill explains when to use @State vs plain properties with @Observable objects
5. "Text field loses focus when I start typing, very frustrating"
โ The skill identifies ForEach identity issues and shows how to use stable IDs
When to Use SwiftUI Debugging
Use this skill when
โ A view isn't updating when you expect it to
โ Preview crashes or won't load
โ Layout looks wrong on specific devices
โ You're tempted to bandaid with @ObservedObject everywhere
Use axiom-xcode-debugging instead when
App crashes at runtime (not preview)
Build fails completely
You need environment diagnostics
Use axiom-swift-concurrency instead when
Questions about async/await or MainActor
Data race warnings
Debugging Tools
Self._printChanges()
SwiftUI provides a debug-only method to understand why a view's body was called.
Usage in LLDB:
// Set breakpoint in view's body// In LLDB console:(lldb) expression Self._printChanges()
Temporary in code (remove before shipping):
var body:someView{let_=Self._printChanges()// Debug onlyText("Hello")}
Output interpretation:
MyView: @self changed
- Means the view value itself changed (parameters passed to view)
MyView: count changed
- Means @State property "count" triggered the update
MyView: (no output)
- Body not being called; view not updating at all
โ ๏ธ Important:
Prefixed with underscore โ May be removed in future releases
NEVER submit to App Store with _printChanges calls
Performance impact โ Use only during debugging
When to use:
Need to understand exact trigger for view update
Investigating unexpected updates
Verifying dependencies after refactoring
Cross-reference: For complex update patterns, use SwiftUI Instrument โ see axiom-swiftui-performance skill
View Not Updating Decision Tree
The most common frustration: you changed @State but the view didn't redraw. The root cause is always one of four things.
Step 1: Can You Reproduce in a Minimal Preview?
#Preview{YourView()}
YES โ The problem is in your code. Continue to Step 2.
NO โ It's likely Xcode state or cache corruption. Skip to Preview Crashes section.
Step 2: Diagnose the Root Cause
Root Cause 1: Struct Mutation
Symptom: You modify a @State value directly, but the view doesn't update.
Why it happens: SwiftUI doesn't see direct mutations on structs. You need to reassign the entire value.
// โ WRONG: Direct mutation doesn't trigger update@Statevar items:[String]=[]funcaddItem(_ item:String){ items.append(item)// SwiftUI doesn't see this change}// โ RIGHT: Reassignment triggers update@Statevar items:[String]=[]funcaddItem(_ item:String){var newItems = items
newItems.append(item)self.items = newItems // Full reassignment}// โ ALSO RIGHT: Use a binding@Statevar items:[String]=[]var itemsBinding:Binding<[String]>{Binding(get:{ items },set:{ items =$0})}
Fix it: Always reassign the entire struct value, not pieces of it.
Root Cause 2: Lost Binding Identity
Symptom: You pass a binding to a child view, but changes in the child don't update the parent.
Why it happens: You're passing .constant() or creating a new binding each time, breaking the two-way connection.
// โ WRONG: Constant binding is read-only@Statevar isOn =falseToggleChild(value:.constant(isOn))// Changes ignored// โ WRONG: New binding created each render@Statevar name =""TextField("Name", text:Binding(get:{ name },set:{ name =$0}))// New binding object each time parent renders// โ RIGHT: Pass the actual binding@Statevar isOn =falseToggleChild(value: $isOn)// โ RIGHT (iOS 17+): Use @Bindable for @Observable objects@ObservableclassBook{var title ="Sample"var isAvailable =true}structEditView:View{@Bindablevar book:Book// Enables $book.title syntaxvar body:someView{TextField("Title", text: $book.title)Toggle("Available", isOn: $book.isAvailable)}}// โ ALSO RIGHT (iOS 17+): @Bindable as local variablestructListView:View{@Stateprivatevar books =[Book(),Book()]var body:someView{List(books){ book in@Bindablevar book = book // Inline bindingTextField("Title", text: $book.title)}}}// โ RIGHT (pre-iOS 17): Create binding once, not in body@Statevar name =""@Statevar nameBinding:Binding<String>?var body:someView{if nameBinding ==nil{ nameBinding =Binding(get:{ name },set:{ name =$0})}returnTextField("Name", text: nameBinding!)}
Fix it: Pass $state directly when possible. For @Observable objects (iOS 17+), use @Bindable. If creating custom bindings (pre-iOS 17), create them in init or cache them, not in body.
Root Cause 3: Accidental View Recreation
Symptom: The view updates, but @State values reset to initial state. You see brief flashes of initial values.
Why it happens: The view got a new identity (removed from a conditional, moved in a container, or the container itself was recreated), causing SwiftUI to treat it as a new view.
โบClaude Desktop or compatible AI client with skill support
โบClear understanding of task or problem to solve
โบWillingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
1Install skill using provided installation command
2Test with simple use case relevant to your work
3Evaluate output quality and relevance
4Iterate on prompts to improve results
5Integrate into regular workflow if valuable
Common Pitfalls
โ Expecting perfect results without iteration
โ Not providing enough context in prompts
โ Using skill for tasks outside its intended scope
โ Accepting outputs without review and validation
Best Practices
โ Do
+Start with clear, specific prompts
+Provide relevant context and constraints
+Review and refine all outputs before using
+Iterate to improve output quality
+Document successful prompt patterns
โ Don't
โDon't use without understanding skill limitations
โDon't skip validation of outputs
โDon't share sensitive information in prompts
โDon't expect skill to replace human judgment
๐ก Pro Tips
โ Be specific about desired format and style
โ Ask for multiple options to choose from
โ Request explanations to understand reasoning
โ Combine AI efficiency with human expertise
When to Use This
โ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
โ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
1Familiarize yourself with skill capabilities and limitations
2Start with low-risk, non-critical tasks
3Progress to more complex and valuable use cases
4Build expertise through regular use and experimentation