generate view
Create a standalone SwiftUI view (no ViewModel).
Creates a single SwiftUI view file for components and reusable presentational UI. No ViewModel, no route, no DI wiring.
Synopsis
Section titled “Synopsis”swiftspawn generate view <Name> [--in <feature>] [--dry-run] [--force] [--quiet] [--verbose]Description
Section titled “Description”For anything that takes inputs and renders UI without owning state: cards, posters, rows, headers, badges. The View suffix is appended automatically.
--in <feature> (or bare in Movies) places the view under Features/<Feature>/. Without it, the view lives at Features/Components/.
Unlike screens, views don’t get their own subfolder. The file lives directly inside the feature folder alongside the screen subfolders.
Examples
Section titled “Examples”swiftspawn generate view MoviePoster in Moviesswiftspawn generate view AvatarGenerated files
Section titled “Generated files”Features/<Feature>/<Name>View.swiftOr, without --in:
Features/Components/<Name>View.swiftSide effects
Section titled “Side effects”None. generate view writes one file; it does not edit Route.swift, RootView.swift, or DIContainer.swift.
Options
Section titled “Options”| Flag | Description |
|---|---|
--in <feature> | Feature folder to place the view under. Bare in <feature> also works. |
--dry-run | Preview without writing. |
--force | Overwrite existing file. |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 2 | Invalid name. |
| 5 | Not in a swiftspawn project. |
See also
Section titled “See also”generate screenfor views that own state.- Vocabulary for the screen-versus-view distinction.