mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
Add complete Apple-style DocC documentation for TUIKit framework: ## Documentation Structure - Main landing page (TUIKit.md) with quick-start and topic navigation - 8 guide articles: GettingStarted, ViewHierarchy, StateManagement, Theming, Appearance, Focus, Modifiers, Architecture - 3 step-by-step tutorials: BuildYourFirstApp, BuildInteractiveMenu, BuildThemableUI - Documentation catalog with proper Info.plist configuration ## Code Improvements - Enhanced Box.swift documentation with clear container comparison - Added comprehensive examples and usage patterns - Explained appearance integration and sizing behavior ## Infrastructure - GitHub Actions workflow (.github/workflows/docc.yml) for automatic DocC building - Configured for deployment to GitHub Pages on push to main - Uses xcrun docc build with proper artifact handling ## Documentation Includes - API reference stubs for all major components - Comprehensive guide articles with code examples - Interactive tutorials following Apple's documentation style - Cross-references using DocC syntax (``Type``) - Best practices and design patterns explained The documentation is ready for automated building and deployment to GitHub Pages.
2.6 KiB
2.6 KiB
TUIKit
Build beautiful, interactive terminal user interfaces in Swift.
Overview
TUIKit is a modern Swift framework for creating sophisticated terminal user interfaces (TUIs) on macOS and Linux. It provides a declarative, SwiftUI-like API with support for themes, styling, focus management, and interactive components.
Key Features
- Declarative UI: Build interfaces using Swift's result builders and view composition
- 5 Appearance Styles: line, rounded, doubleLine, heavy, and block rendering modes
- 4 Phosphor Themes: Green, Amber, White, and Red with customizable colors
- Rich Components: Text, Button, Menu, Alert, Dialog, Card, Panel, and more
- Focus Management: Tab/Shift+Tab navigation with keyboard shortcuts
- State Management:
@State,@Environment,@AppStorage,@SceneStorageproperty wrappers - No Dependencies: Pure Swift implementation for macOS 10.15+ and Linux
Getting Started
Create your first TUIKit app in minutes:
import TUIKit
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
VStack(spacing: 1) {
Text("Welcome to TUIKit!")
.bold()
.foregroundColor(.theme.accent)
Spacer()
Button("Press me") {
print("Button pressed!")
}
Spacer()
}
.padding()
}
}
}
Run with: swift run
Topics
Essentials
ViewAppScene@main
Building Views
- doc:ViewHierarchy
- doc:GettingStarted
VStackHStackZStackForEach
Interactive Components
ButtonMenuAlertDialogText
Styling & Appearance
- doc:Theming
- doc:Appearance
ColorThemeAppearance
Layout & Modifiers
- doc:Modifiers
View/padding(_:)-19gu9View/frame(width:height:alignment:)View/border(_:style:)-4xzvw
State Management
- doc:StateManagement
StateBinding@Environment@AppStorage
Advanced Topics
- doc:Focus
- doc:Architecture
- doc:Rendering
FocusManagerKeyEvent
Examples
Resources
Minimum Requirements
- Swift 6.0 or later
- macOS 10.15+ or Linux (glibc)
- Terminal with ANSI color support (256 colors or better)