SkillAgentSearch skills...

TextUI

A SwiftUI-inspired framework for building expressive terminal UIs in Swift, with zero dependencies.

Install / Use

/learn @bensyverson/TextUI
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

TextUI

A SwiftUI-inspired framework for building expressive terminal UIs in Swift, with zero dependencies.

Why? Why not! It makes building fancy terminal apps super fun.

Quick Start

Add TextUI to your Package.swift:

dependencies: [
    .package(url: "https://github.com/bensyverson/TextUI.git", branch: "main"),
]

Create a terminal app:

import TextUI

@main
struct HelloApp: App {
    var body: some View {
        VStack(spacing: 1) {
            Text("Hello, TextUI!", style: .bold)
            Button("Quit") { Application.quit() }
                .keyboardShortcut("q", modifiers: .control)
            CommandBar()
        }
        .padding(1)
        .border()
    }
}

Features

  • Declarative views — Text, HStack, VStack, ZStack, Spacer, Divider, Color, Canvas
  • Interactive controls — Button, TextField, Toggle, Picker with Tab/Shift-Tab focus navigation
  • Containers — ScrollView, Table, TabView
  • State management — View-local @State and shared state via @EnvironmentObject
  • Modifiers.padding(), .border(), .foregroundColor(), .background(), .frame()
  • Command system — Global keyboard shortcuts, CommandBar, and Ctrl+P command palette
  • Animation — ProgressView with spinner and bar styles
  • Terminal handling — Raw mode, alternate screen, resize detection, 24-bit color with automatic downgrade

Documentation

Browse the documentation online, or check out the DocC catalog at Sources/TextUI/Documentation.docc/. Key articles:

You can generate the API documentation with DocC:

swift package generate-documentation --target TextUI

# Serve the docs:
swift package --disable-sandbox preview-documentation --target TextUI

Key guides:

  • Getting Started — Package setup, creating an app, adding views and state
  • Views — Catalog of all built-in views with examples
  • Focus and Input — Keyboard navigation, @FocusState, key event handling
  • Command System — Global shortcuts, CommandBar, command palette
  • TextUI vs SwiftUI — Key differences for SwiftUI developers

Requirements

  • Swift 6.2+
  • macOS 13+ or Linux (glibc)

Development

Enable the pre-commit hook (runs swiftformat lint + tests):

git config core.hooksPath scripts

Demo App

Run the showcase demo:

cd Examples/Demo
swift run

The demo includes tabs for form controls, a data table, progress indicators, a log which updates via an async process, and a tab of the remaining layout primitives.


License

This project is licensed under the MIT License.

Copyright (c) 2026 Ben Syverson

View on GitHub
GitHub Stars12
CategoryDevelopment
Updated2d ago
Forks1

Languages

Swift

Security Score

95/100

Audited on Apr 4, 2026

No findings