fosmvvm-swiftui-view-generator
Generate SwiftUI views that render FOSMVVM ViewModels. Scaffolds ViewModelView pattern with binding, loading states, and previews.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/foscomputerservices/fosmvvm-swiftui-view-generatorFOSMVVM SwiftUI View Generator
Generate SwiftUI views that render FOSMVVM ViewModels.
Conceptual Foundation
For full architecture context, see FOSMVVMArchitecture.md | OpenClaw reference
In FOSMVVM, Views are thin rendering layers that display ViewModels:
┌─────────────────────────────────────────────────────────────┐
│ ViewModelView Pattern │
├─────────────────────────────────────────────────────────────┤
│ │
│ ViewModel (Data) ViewModelView (SwiftUI) │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ title: String │────►│ Text(vm.title) │ │
│ │ items: [Item] │────►│ ForEach(vm.items)│ │
│ │ isEnabled: Bool │────►│ .disabled(!...) │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
│ Operations (Actions) │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ submit() │◄────│ Button(action:) │ │
│ │ cancel() │◄────│ .onAppear { } │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Key principle: Views don't transform or compute data. They render what the ViewModel provides.
View-ViewModel Alignment
The View filename should match the ViewModel it renders.
Sources/
{ViewModelsTarget}/
{Feature}/
{Feature}ViewModel.swift ←──┐
{Entity}CardViewModel.swift ←──┼── Same names
│
{ViewsTarget}/ │
{Feature}/ │
{Feature}View.swift ────┤ (renders {Feature}ViewModel)
{Entity}CardView.swift ────┘ (renders {Entity}CardViewModel)
This alignment provides:
- Discoverability - Find the view for any ViewModel instantly
- Consistency - Same naming discipline across the codebase
- Maintainability - Changes to ViewModel are reflected in view location
Core Components
1. ViewModelView Protocol
Every view conforms to ViewModelView:
public struct MyView: ViewModelView {
private let viewModel: MyViewModel
public var body: some View {
Text(viewModel.title)
}
public init(viewModel: MyViewModel) {
self.viewModel = viewModel
}
}
Required:
private let viewModel: {ViewModel}public init(viewModel:)- Conforms to
ViewModelViewprotocol
2. Operations (Optional)
Interactive views have operations:
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-foscomputerservices-fosmvvm-swiftui-view-generator": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
fosmvvm-leaf-view-generator
Generate Leaf templates for FOSMVVM WebApps. Create full-page views and HTML-over-the-wire fragments that render ViewModels.
fosmvvm-react-view-generator
Generate React components that render FOSMVVM ViewModels. Scaffolds ViewModelView pattern with hooks, loading states, and TypeScript types.
fosmvvm-fields-generator
Generate FOSMVVM Fields protocols with validation rules, FormField definitions, and localized messages. Define form contracts once, validate everywhere.
fosmvvm-fluent-datamodel-generator
Generate Fluent DataModels for FOSMVVM server-side persistence. Scaffolds models, migrations, and tests for database-backed entities.
fosmvvm-swiftui-app-setup
Set up the @main App struct for FOSMVVM SwiftUI apps. Configures MVVMEnvironment, deployment URLs, and test infrastructure.