new
Create a new iOS app at ./<AppName>/.
Scaffolds a complete project: the Xcode project, the SPM manifest, the infrastructure layer, a placeholder feature, and the CLI’s own config file.
Synopsis
Section titled “Synopsis”swiftspawn new <AppName> [--bundle-id <id>] [--no-prompt] [--no-xcodeproj] [--dry-run] [--force] [--quiet] [--verbose]Description
Section titled “Description”new produces a project that opens in Xcode and runs in the simulator on first build. The infrastructure layer is the same across projects: APIClient, Router, AppError, TokenStore, DIContainer, Log. A single placeholder screen (HelloView) is included so the navigation stack has something to render.
The generated project targets iOS 17+ and Swift 6, uses SwiftUI for views, @MainActor @Observable for ViewModels, and Factory for dependency injection.
By default the bundle id is com.example.<appname>. Use --bundle-id to override. Pass --no-xcodeproj if you only want an SPM project (no .xcodeproj); you’ll then open Package.swift in Xcode instead.
Examples
Section titled “Examples”swiftspawn new MovieAppswiftspawn new MovieApp --bundle-id com.acme.movieappswiftspawn new MovieApp --no-xcodeprojGenerated files
Section titled “Generated files”<AppName>/├── <AppName>.xcodeproj/├── Package.swift├── .swiftspawn.yml├── .swiftlint.yml├── .swiftformat├── .gitignore├── README.md├── Configs/│ ├── Debug.xcconfig│ ├── Staging.xcconfig│ └── Release.xcconfig└── <AppName>/ ├── App/ │ ├── <AppName>App.swift │ ├── RootView.swift │ ├── HelloView.swift │ └── DIContainer.swift ├── Infrastructure/ │ ├── Networking/ │ │ ├── APIClient.swift │ │ ├── APIRequest.swift │ │ ├── APIConfig.swift │ │ ├── AppError.swift │ │ ├── AuthInterceptor.swift │ │ └── LoggingInterceptor.swift │ ├── Routing/ │ │ ├── Route.swift │ │ └── Router.swift │ ├── Auth/ │ │ └── TokenStore.swift │ └── Logging/ │ └── Log.swift ├── Resources/ │ ├── Assets.xcassets/ │ └── Info.plist ├── Features/ └── Services/See Project layout for what each folder is for.
Side effects
Section titled “Side effects”None on existing files; new writes into a fresh directory. If <AppName>/ already exists, new fails unless --force is passed.
Options
Section titled “Options”| Flag | Description |
|---|---|
--bundle-id <id> | Bundle identifier. Defaults to com.example.<appname>. |
--no-prompt | Skip interactive prompts; use defaults. |
--no-xcodeproj | Skip .xcodeproj generation; SPM-only project. |
--dry-run | Show what would change without writing any files. |
--force | Overwrite existing directory. |
--quiet | Suppress non-error output. |
--verbose | Print detailed operation logs. |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 2 | Invalid app name (must be a valid Swift identifier). |
| 3 | Directory already exists; pass --force to overwrite. |
| 4 | Insufficient disk space. |
| 13 | Bundled template missing (build issue). |