loom & weft
Made for Swift.

Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.

LOOM Unreleased (PR #2) / ADDITIONAL WIDGETS AND TEXT

TextLine

Styled source text with an optional alignment overriding its paragraph.

Soft-wrapped rows and explicit newlines within this line inherit its alignment. Nil keeps the paragraph's alignment. Alignment never changes copied source text.

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

let layout = TextLayout(lines: [TextLine("Heading", alignment: .center), TextLine("Body")], width: 30)
_ = Paragraph(layout)
Members on this page

Feature guides and release status

TextLine

Structure
struct TextLine

Conforms to: Swift.Sendable, Swift.SendableMetatype.

Styled source text with an optional alignment overriding its paragraph.

Soft-wrapped rows and explicit newlines within this line inherit its alignment. Nil keeps the paragraph's alignment. Alignment never changes copied source text.

Source · TextLine.swift:5

spans

Instance Property
var spans: [TextSpan]

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TextLine.swift:6

alignment

Instance Property
var alignment: CellAlignment?

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TextLine.swift:7

init(_:style:alignment:)

Initializer
init(_ text: String, style: Style? = nil, alignment: CellAlignment? = nil)

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (3)
text
Source text.
style
Text/cell appearance.
alignment
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · TextLine.swift:9

init(_:alignment:)

Initializer
init(_ spans: [TextSpan], alignment: CellAlignment? = nil)

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (2)
spans
Styled source spans, in order.
alignment
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · TextLine.swift:13