Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / COLLECTIONS AND INTERACTION
Table
A selectable table with fixed headers/footers and clipped, independently scrollable body rows.
Sorting/filtering and cell actions belong to the caller. Set minimumWidth to allow
horizontal scrolling instead of squeezing columns into a narrow viewport.
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
_ = Table(columns: [TableColumn("Name", width: .fill(1))], rows: [TableRow(id: 1, cells: [TableCell("Ready")])])Members on this page
Feature guides and release status
Table
struct Table<ID> where ID : HashableConforms to: StatefulWidget.
A selectable table with fixed headers/footers and clipped, independently scrollable body rows.
Sorting/filtering and cell actions belong to the caller. Set minimumWidth to allow
horizontal scrolling instead of squeezing columns into a narrow viewport.
columns
var columns: [TableColumn]A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:134rows
var rows: [TableRow<ID>]A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:135columnSpacing
var columnSpacing: IntA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:136automaticHeights
var automaticHeights: BoolMeasures body text using the final column widths.
Source · Table.swift:138wrapping
var wrapping: TextWrappingA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:139wrapOptions
var wrapOptions: TextWrapOptionsA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:140minimumWidth
var minimumWidth: IntA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:141showsHeader
var showsHeader: BoolA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:142headerHeight
var headerHeight: IntA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:143style
var style: StyleVisual attributes used when painting this value.
Source · Table.swift:146headerStyle
var headerStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:147selectionStyle
var selectionStyle: StyleStyle used for the selected choice/icon.
Source · Table.swift:149markedStyle
var markedStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:150cellSelectionStyle
var cellSelectionStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:151columnSelectionStyle
var columnSelectionStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:152selectionSymbol
var selectionSymbol: StringA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:153prefixReservation
var prefixReservation: SelectionPrefixReservationA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:154selectionPatch
var selectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:155columnSelectionPatch
var columnSelectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:156cellSelectionPatch
var cellSelectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:157emptyMessage
var emptyMessage: StringText shown when the popup has no items.
Source · Table.swift:158init(columns:rows:)
init(columns: [TableColumn], rows: [TableRow<ID>])Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (2)
columns- Cell-column count or signed column movement, according to the method.
rows- Row count or signed row movement, according to the method.
bodyArea(in:)
func bodyArea(in area: Rect) -> RectReturns the body rectangle after reserving header and footer rows, clamped for small viewports.
Parameters (1)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Rect.
columnAreas(width:)
func columnAreas(width: Int) -> [Rect]Column regions in logical content coordinates, before horizontal scrolling.
Parameters (1)
width- Available columns in terminal cells.
Returns [Rect].
update(in:state:)
func update(in area: Rect, state: inout TableState<ID>)Synchronizes data and geometry before dispatching events.
Drawing also calls this method.
Parameters (2)
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.
render(in:buffer:state:)
func render(in area: Rect, buffer: inout Buffer, state: inout TableState<ID>)Reconciles the caller-owned selection metrics and paints visible rows using the same geometry as hit testing.
Parameters (3)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
buffer- Mutable destination cell grid.
state- Argument type and any default are shown in the declaration; see the behavior notes above.
cell(at:in:state:)
func cell(at point: Point, in area: Rect, state: TableState<ID>) -> (row: ID, column: Int)?Returns body cells only; headers, footers, spacing, and unused columns return nil.
Parameters (3)
at- 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.
Returns (row: ID, column: Int)?.
contentArea(in:state:)
func contentArea(in area: Rect, state: TableState<ID>) -> RectContent viewport after the fixed selection prefix gutter.
Parameters (2)
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.
Returns Rect.