mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
Update IDETemplateMacros.plist and replace headers in 136 Swift files with
new format: 🖥️ TUIKit — Terminal UI Kit for Swift. Remove sdsd.swift template draft.
38 lines
980 B
Swift
38 lines
980 B
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
|
// TUIkit.swift
|
|
//
|
|
// Created by LAYERED.work
|
|
// CC BY-NC-SA 4.0
|
|
// TUIkit enables creating TUI applications with a declarative,
|
|
// SwiftUI-like syntax - without ncurses or other low-level libraries.
|
|
//
|
|
|
|
/// The current version of TUIkit.
|
|
public let tuiKitVersion = "0.1.0"
|
|
|
|
/// Executes a view closure and renders it once.
|
|
///
|
|
/// This is useful for simple CLI tools that don't need a full App.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// ```swift
|
|
/// renderOnce {
|
|
/// VStack {
|
|
/// Text("Hello, TUIkit!")
|
|
/// .bold()
|
|
/// .foregroundColor(.cyan)
|
|
/// Divider()
|
|
/// Text("Version \(tuiKitVersion)")
|
|
/// .dim()
|
|
/// }
|
|
/// }
|
|
/// ```
|
|
///
|
|
/// - Parameter content: A ViewBuilder closure that defines the view to render.
|
|
public func renderOnce<Content: View>(@ViewBuilder content: () -> Content) {
|
|
let view = content()
|
|
let renderer = ViewRenderer()
|
|
renderer.render(view)
|
|
}
|