TUIkit is a SwiftUI-like framework for building Terminal User Interfaces in pure Swift, with no ncurses or C dependencies. It targets SwiftUI API parity wherever possible.
| Requirement | Details |
|---|---|
| Swift 6.0 | swift-tools-version: 6.0. Never use features from a newer compiler. |
| Cross-platform | Must build and run on both macOS and Linux. CI tests both (macos-15 + swift:6.0 container). |
| CI must pass | All tests and linting must pass before merge. |
# Build
swift build
# Run all tests (1037+ tests, Swift Testing framework)
swift test
# Run a single test suite
swift test --filter <TestSuiteName>
# Lint
swiftlint
# Format (configured but not enforced in CI)
swift-format format -i -r Sources Tests- Branch from
main - Fill in the PR template completely
- CI must be green (macOS + Linux)
- No new SwiftLint warnings
- Follow the architecture and API rules below
Public APIs must match SwiftUI signatures exactly unless terminal constraints require deviation (document why in comments).
| Aspect | Requirement |
|---|---|
| Parameter names | Exact (isPresented, not isVisible) |
| Parameter order | Exact (title, binding, actions, message) |
| Parameter types | Match closely (ViewBuilder closures, not pre-built values) |
| Trailing closures | @ViewBuilder () -> T, not String |
Before implementing any SwiftUI-equivalent API: Look up the exact SwiftUI signature first.
- Every public control must be a
Viewwith a realbody: some View - The
bodymust return actual Views (notNever, notfatalError()) Renderableis only for leaf nodes (Text,Spacer,Divider) and private_*Coreviews- All modifiers must propagate through the entire View hierarchy
- Environment values must flow down automatically
- No singletons
- Search the codebase for similar patterns before implementing anything new
- Consolidate and reuse before adding new functions or types
- Line length: 140 characters (warning), 200 (error)
- 4-space indentation
- Trailing commas in multi-line collections
- See
.swiftlint.ymland.swift-formatfor full configuration
- Uses Swift Testing framework (
@Test,#expect,@Suite) - Tests run in parallel
- Test files mirror source structure in
Tests/TUIkitTests/
For comprehensive architecture documentation including the _*Core pattern, focus system, state management, and interactive view rules, see .claude/CLAUDE.md.