终端“字符型”渲染,由ANSI转义序列驱动。此库不依赖 Foundation。
import TerminaLib
var t = Termina(width: 1, height: 1)
let lines = ["|", "\\", "-", "/"]
for i in 1 ... 100 {
t.render(bitmap: [lines[i % lines.count]], to: stdout)
usleep(10000)
}
t.clear(stdout) // use "t.end()" if you want to keep the rendered content