Swift Binding Fixer
SKILL.md
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