home / skills / willsigmon / sigstack / modal-sheet-debugger
This skill helps you fix SwiftUI sheet presentation issues in Leavn by resolving competing sheets, consolidating patterns, and ensuring proper dismissal and
npx playbooks add skill willsigmon/sigstack --skill modal-sheet-debuggerReview the files below or copy the command above to add this skill to your agents.
---
name: Modal Sheet Debugger
description: Fix SwiftUI sheet presentation issues in Leavn - competing sheets, dismissal patterns, binding synchronization, enum-based consolidation
allowed-tools: Read, Edit, Grep
---
# Modal Sheet Debugger
Fix sheet presentation issues:
1. **Find competing sheets**: Multiple `.sheet()` modifiers on same view
2. **Consolidate pattern**:
```swift
enum SheetType: Identifiable {
case optionA, optionB
var id: String { ... }
}
@State var activeSheet: SheetType?
.sheet(item: $activeSheet) { type in
switch type { ... }
}
```
3. **Fix dismissal**: Update binding before dismiss()
4. **Check bindings**: Ensure parent and environment in sync
Use when: Multiple sheets conflict, dismissal bugs, sheet state issues
This skill helps diagnose and fix SwiftUI sheet presentation problems in Leavn. It locates conflicting sheet modifiers, consolidates multiple sheets into a single enum-driven sheet, and recommends fixes for dismissal and binding synchronization. The goal is reliable, predictable modal behavior across view hierarchies.
It inspects view hierarchies and sheet usage patterns to find multiple .sheet() modifiers attached to the same view or overlapping view scopes. It suggests consolidating into a single Identifiable-driven sheet using an enum, ensures you update state bindings before calling dismiss(), and checks that parent state and environment bindings remain synchronized. It also points out common binding race conditions and state propagation issues.
Why do multiple .sheet modifiers cause issues?
SwiftUI can only reliably manage one active sheet per view scope; multiple modifiers can compete and produce unpredictable presentation behavior.
How does an Identifiable enum help?
An enum as Identifiable centralizes modal types so a single .sheet(item:) can switch on the enum to present different content without modifier conflicts.