Documentation
SwiftTUI documentation
Organized by what you're doing: your first hour, then the reference guides for views, state, and focus, charts, and what lies beyond the terminal. The module-by-module API reference is at the end.
Your first hour
Read these in order. Each one picks up where the last left off, from an empty package to an app that handles state, focus, and the terminal's own rules.
- 01Add it to your appPick a toolchain, add the package, paste the counter, swift run.
- 02Authoring ViewsCompose containers, local state, focused controls, and modifiers around a body-driven tree.
- 03State, Environment, and FocusState, observation, environment, and focus share one runtime invalidation path.
- 04Running AppsThe @main entry point, the standard flags, exit keys, and rendering one frame without a TTY.
- 05Coming from SwiftUIWhat transfers unchanged, which reflexes need retraining, and what is not here yet.
Build your interface
The reference guides, one per subsystem, from the SwiftTUIViews catalog. Read them as you need them.
Charts
Sparklines, bar and line charts, heatmaps, meters, and calendar views ship separately as swift-tui-charts, composed on the same view surface.
At run time
What a running terminal app reads and can do, from the SwiftTUIRuntime catalog.
Beyond the terminal
Terminal first, not terminal only. The same app runs in a browser, inside native SwiftUI windows, and on Android; these guides own that path and its platform notes.
Concepts and background
API reference by module
The combined DocC archive documents each module. Most app code touches only the first row.
What you import
- SwiftTUI — the batteries-included app product
- SwiftTUIViews — views, controls, layout, state, focus
- SwiftTUIRuntime — scenes, run loop, host integration
- SwiftTUICharts — charts and compact metrics
Hosts and opt-in products
- SwiftTUICLI — terminal-only runner
- SwiftTUIWebHostCLI — terminal runner with --web
- SwiftTUIArguments — SwiftTUIOptions and command parsing
- SwiftTUIWebHost — localhost browser host
- SwiftTUIWASI — WASI and browser builds
- SwiftTUIAndroidHost — Android embedding
- SwiftTUITerminal — embedded terminal panes
- SwiftTUIAnimatedImage — animated GIF and image views
- SwiftTUIProfiling — opt-in profiling and diagnostics
- SwiftUIHost — native SwiftUI embedding (separate package)
The last group declares types that reach app code through re-export — CellSize, Alignment,PreferenceKey, SwiftTUIOptions — so their pages document symbols you use, behind imports you never write.