| 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 |
Swift Binding Fixer
Instructions
Fix "cannot find '$viewModel'" errors:
Find the error:
grep "cannot find '\$viewModel'" build_output.txtRead 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: MyViewModelCommon 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