generate route
Add a route case to Route.swift.
Adds a single case to Route.swift between the auto-managed markers. Useful for hand-written screens or routes that need parameters.
Synopsis
Section titled “Synopsis”swiftspawn generate route <name> [--dry-run] [--force] [--quiet] [--verbose]Description
Section titled “Description”Most of the time you don’t need this directly: generate screen adds a route case for you. Use generate route when:
- You wrote the screen by hand (not via
generate screen). - You need a route case with associated values, like
case movieDetail(id: Int). Generate the bare case here, then edit the file to add the parameter.
The case name is camelCase. Cases are kept sorted alphabetically inside the marker region.
Examples
Section titled “Examples”swiftspawn generate route notificationsswiftspawn generate route movieDetailAfter running the second one, edit Route.swift to add the parameter:
case movieDetail(id: Int)Generated files
Section titled “Generated files”None.
Side effects
Section titled “Side effects”- Adds
case <name>toRoute.swiftbetween the markers, sorted alphabetically.
Options
Section titled “Options”| Flag | Description |
|---|---|
--dry-run | Preview without writing. |
--force | No-op for this command (route insertion is idempotent on duplicates only with --force). |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 2 | Invalid name (must be a valid camelCase identifier). |
| 5 | Not in a swiftspawn project. |
| 7 | Route.swift is missing the markers. |
| 12 | Route case already exists. |