Skip to content

jowtheshiba/SwiftyTermUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftyTermUI

Note: This project is currently under development. Cross-platform support is coming later. Tested on macOS.

scr

 

SwiftyTermUI consists of two main parts:

  • Low-level engine: A Swift analogue of ncurses for direct terminal control and drawing primitives, built from scratch without any external dependencies.
  • High-level framework: An attempt to recreate the classic Turbo Vision experience in a modern context.

Main API

let tui = SwiftyTermUI.shared

// Initialize terminal
try tui.initialize()

// Draw content
tui.drawString(row: 0, column: 0, text: "Hello")
tui.drawChar(row: 1, column: 0, character: "A", attributes: TextAttributes(bold: true))

// Render to terminal
try tui.refresh()

// Read input
if let event = tui.readEvent() {
    switch event {
    case .keyPress(let key):
        // Handle key
    case .terminalResize:
        // Handle resize
    }
}

// Cleanup
tui.shutdown()

Building

swift build

Examples

SwiftyTermUI includes several examples demonstrating different features:

Example Description
HelloTermUI.swift Basic setup and text drawing with colors and attributes
DrawingExample.swift Lines, rectangles, and geometric shapes drawing
WindowExample.swift Window management, panels, and window stacking
InputExample.swift Keyboard input handling including special keys
ComponentsExample.swift High-level components (Menu, Form, Button, TextBox, ProgressBar)
OptimizationExample.swift Demonstrates render optimization features and statistics
RetroDemo.swift A comprehensive demo of retro-styled UI components and interactions

Run any example with:

swift run <ExampleName>

About

A modern Swift TUI framework featuring an ncurses analogue and a classic Turbo Vision-style interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages