Our review
Fixes SwiftUI 'cannot find $viewModel' errors by adding @Bindable to @Observable ViewModels.
Strengths
- Automates a repetitive fix
- Uses concrete patterns from the Leavn app
- Combines grep and editing for precise correction
Limitations
- Only works with @Observable ViewModels
- May need manual tweaking for unlisted cases
- Depends on build_output.txt for error detection
When the SwiftUI compiler reports a $viewModel binding error in a view using an @Observable ViewModel.
For binding errors not related to @Observable or in projects without SwiftUI ViewModels.
Security analysis
SafeThe skill uses only safe tools (Read, Edit, Grep) to modify Swift source code. It fixes a specific SwiftUI binding issue without any destructive, obfuscated, or exfiltrating actions.
No concerns found
Examples
Fix 'cannot find $viewModel' error in HomeView. The viewModel is @Observable HomeViewModel and uses $viewModel in sheet bindings.Fix binding error: Cannot find '$viewModel' in CommunityView. The viewModel is @Observable CommunityViewModel and uses $viewModel for showCreateSheet bindings.name: swift-binding-fixer description: Fix SwiftUI binding errors ($var issues) by adding @Bindable to @Observable ViewModels in Leavn app allowed-tools: Read, Edit, Grep disable-model-invocation: false context: fork user-invocable: true argument-hint: "[context]"
Swift Binding Fixer
Instructions
Fix "cannot find '$viewModel'" errors:
-
Find the error:
grep "cannot find '\$viewModel'" build_output.txt -
Read the view file:
- Check if viewModel is @Observable type
- Look for
@State var viewModelorvar viewModel - Find all
$viewModel.propertyusages
-
Apply fix:
// BEFORE @State var viewModel: MyViewModel // OR var viewModel: MyViewModel // AFTER (if using $viewModel) @Bindable var viewModel: MyViewModel -
Common Leavn patterns:
- HomeViewModel: Use @Bindable for sheet bindings
- CommunityViewModel: Use @Bindable for showCreate* bindings
- SettingsViewModel: Use @Bindable for alert bindings
- SermonAIView: Use @Bindable for showing* bindings
Use this skill when: $viewModel errors, @Observable binding issues, sheet presentation errors
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.