Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / RENDERING AND LAYOUT
Frame
Coordinates are absolute, zero-based terminal cells. Render widgets in order: later writes replace earlier cells. Set cursor to a valid point to show it, or leave it nil to hide it. Terminal.draw resets the frame before each rendering pass.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
var frame = Frame(width: 80, height: 24)
frame.render(Paragraph(TextLayout("Hello", width: 80)), in: frame.area)
frame.cursor = Point(x: 0, y: 1)Members on this page
Feature guides and release status
Frame
struct FrameThe logical screen and cursor produced by one rendering pass.
Source · Frame.swift:4buffer
var buffer: BufferThe mutable grid of cells for the frame.
Source · Frame.swift:5cursor
var cursor: Point?The cursor position; see the type’s coordinate convention and lifecycle notes.
Source · Frame.swift:6area
var area: Rect { get }The available zero-based rectangle in terminal cells.
Source · Frame.swift:7init(width:height:)
init(width: Int, height: Int)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (2)
width- Available columns in terminal cells.
height- Available rows in terminal cells.
render(_:in:)
mutating func render<W>(_ widget: W, in area: Rect) where W : WidgetDelegates to the widget with the assigned absolute rectangle and the frame’s mutable buffer. Does not automatically intersect the rectangle with the buffer.
Parameters (2)
widget- Argument type and any default are shown in the declaration; see the behavior notes above.
in- Argument type and any default are shown in the declaration; see the behavior notes above.
render(_:in:state:)
mutating func render<W>(_ widget: W, in area: Rect, state: inout W.State) where W : StatefulWidgetDelegates rendering to a StatefulWidget using the supplied caller-owned state and assigned rectangle.
Parameters (3)
widget- Argument type and any default are shown in the declaration; see the behavior notes above.
in- Argument type and any default are shown in the declaration; see the behavior notes above.
state- Argument type and any default are shown in the declaration; see the behavior notes above.