rensbreur / SwiftTUI

SwiftUI for terminal applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Renderer Brakes when compiling most basic app

devinhayward opened this issue · comments

Hi I tried to compile and run the basic app:

import SwiftTUI

struct MyTerminalView: View {
var body: some View {
Text("Hello, world!")
}
}

Application(rootView: MyTerminalView()).start()

and broke at runtime;

/// Draw a specific area, or the entire layer if the area is nil.
func draw(rect: Rect? = nil) {
if rect == nil { layer.invalidated = nil }
let rect = rect ?? Rect(position: .zero, size: layer.frame.size)
for line in rect.minLine ... rect.maxLine { (Fatal error: Range requires lowerBound <= upperBound)
for column in rect.minColumn ... rect.maxColumn {
let position = Position(column: column, line: line)
if let cell = layer.cell(at: position) {
drawPixel(cell, at: Position(column: column, line: line))
}
}
}
}

Hi @devinhayward, it works fine for me. Which terminal are you using?

I am using standard macOS Sonoma 14.5 Beta, with Xcode 15.3.

Builds fine but when it runs I get the crash (Fatal error: Range requires lowerBound <= upperBound) for the draw func in your Renderer Class.

It doesn't work in the Xcode console, you need to use a proper terminal emulator. For example, open the built-in macOS Terminal app, change to the directory of your package and run

swift run

Got it. Will work without Xcode and the Swift Package Manager workflow only. Thanks!