Agent skill
swiftui-debug
Debug SwiftUI view issues (state, bindings, rendering)
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/swiftui-debug-willsigmon-sigstack-site
SKILL.md
SwiftUI Debugging Guide
Debug common SwiftUI issues in the Leavn app:
Common Issues
1. View Not Updating
Check:
- Is ViewModel using
@Observablemacro? - Are properties marked
@MainActorif needed? - Is view observing the right object?
Fix:
// Ensure ViewModel is @Observable
@Observable
class MyViewModel {
var state: String = "" // Auto-tracked
}
// Ensure view observes it
@State var viewModel = MyViewModel() // Not @StateObject
2. Binding Not Working
Check:
- Is the binding two-way?
- Is the source value actually mutable?
- Is there a
@Bindingvs@Statemismatch?
Fix:
// Correct binding chain
@State var value: String
TextField("", text: $value) // $ creates Binding
3. Modal/Sheet Won't Dismiss
Check:
- Is
@Environment(\.dismiss)being called? - Is
isPresentedbinding being set to false? - Are there multiple presentation modifiers conflicting?
Fix:
@Environment(\.dismiss) var dismiss
Button("Close") {
isPresented = false // Update binding
dismiss() // Call environment dismiss
}
4. Performance Issues
Check:
- Are views too complex? (use
Self._printChanges()) - Unnecessary re-renders?
- Heavy computations in body?
Fix:
- Extract subviews
- Use
@Statesparingly - Move logic to ViewModel
Return specific fixes for the reported SwiftUI issue.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?