Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / COLLECTIONS AND INTERACTION
List
A selectable, scrollable collection with custom row rendering and shared hit-test geometry.
Sorting/filtering belong to the caller. Pass stable, unique IDs for selection to survive reordering. Only visible rows are rendered. Row heights are explicit by default; automatic measurement is opt-in.
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 list = List([ListItem(id: "a", "First\nSecond")])
list.automaticHeights = true
list.repeatHighlightSymbol = trueMembers on this page
Feature guides and release status
List
struct List<ID> where ID : HashableConforms to: StatefulWidget.
A selectable, scrollable collection with custom row rendering and shared hit-test geometry.
Sorting/filtering belong to the caller. Pass stable, unique IDs for selection to survive reordering. Only visible rows are rendered. Row heights are explicit by default; automatic measurement is opt-in.
Source · List.swift:41items
var items: [ListItem<ID>]The menu’s choices in display order.
Source · List.swift:42style
var style: StyleVisual attributes used when painting this value.
Source · List.swift:43selectionStyle
var selectionStyle: StyleStyle used for the selected choice/icon.
Source · List.swift:44markedStyle
var markedStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:45selectionSymbol
var selectionSymbol: StringA public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:46repeatHighlightSymbol
var repeatHighlightSymbol: BoolRepeats the selection symbol on every terminal row of the selected item, including blank rows.
The prefix width and content geometry are unchanged.
Source · List.swift:50prefixReservation
var prefixReservation: SelectionPrefixReservationA public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:51selectionPatch
var selectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:52markedPatch
var markedPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:53emptyMessage
var emptyMessage: StringText shown when the popup has no items.
Source · List.swift:54alignment
var alignment: CellAlignmentA public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:55reversed
var reversed: BoolPlaces the first item at the bottom; navigation follows screen direction.
Source · List.swift:57automaticHeights
var automaticHeights: BoolMeasures default text at its final content width when enabled.
Source · List.swift:59wrapping
var wrapping: TextWrappingA public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:60wrapOptions
var wrapOptions: TextWrapOptionsA public field of this type. Its value type and mutability are shown in the declaration.
Source · List.swift:61measureRow
var measureRow: ((ListItem<ID>, Int) -> Int)?Required to measure custom row rendering; width excludes the selection prefix.
Source · List.swift:63renderRow
var renderRow: ((ListItem<ID>, ListRowAppearance, Rect, inout Buffer) -> Void)?Optional custom drawing, clipped to the row and viewport.
Coordinates remain absolute.
Source · List.swift:68init(_:)
init(_ items: [ListItem<ID>])Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (1)
items- Choices in display order.
update(in:state:)
func update(in area: Rect, state: inout SelectionState<ID>)Synchronizes data/geometry before event dispatch.
Rendering 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 SelectionState<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.
item(at:in:state:)
func item(at point: Point, in area: Rect, state: SelectionState<ID>) -> ID?Call after update/draw with the same items and area.
Padding below the last item returns 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 ID?.