GridRow
public struct GridRow : Element
Like Row, GridRow displays a list of items in a linear horizontal layout. Unlike Row, GridRow provides
convenience for describing columnar layout.
Horizontally, GridRow children are stretched to fill the available space. Vertically, children are aligned
according to the verticalAlignment property.
Children may be sized proportionally or absolutely. Proportionally-sized children are granted a proportion of the total layout space after absolutely-sized children and margins have been subtracted.
Example:
GridRow { row in
row.verticalAlignment = .fill
row.spacing = 8.0
row.add(width: .proportional(0.75), child: name)
row.add(width: .proportional(0.25), child: number)
row.add(width: .absolute(100), child: status)
}
Expected layout:
┌────────────────────────────┬─┬────────┬─┬──────────────────┐
│ name │ │ number │ │ status │
│ (75%) │8│ (25%) │8│ (100 pts) │
│ │ │ │ │ │
●──────────── 150 ───────────● ●── 50 ──● ●─────── 100 ──────●
└────────────────────────────┴─┴────────┴─┴──────────────────┘
●──────────────────────────── 316 ───────────────────────────●
-
How children are aligned vertically. By default,
.fill.Declaration
Swift
public var verticalAlignment: Row.RowAlignment -
The space between children. By default, 0.
Declaration
Swift
public var spacing: CGFloat -
The child elements to be laid out. By default, an empty array.
Declaration
Swift
public var children: [Child]
-
Declaration
Swift
public init(configure: (inout GridRow) -> Void = { _ in }) -
Initializer using result builder to declaritively build up a grid row.
Declaration
Swift
public init( verticalAlignment: Row.RowAlignment = .fill, spacing: CGFloat = 0, @ElementBuilder<Child> _ elements: () -> [Child] )Parameters
verticalAlignmentHow children are aligned vertically. By default,
.fill.spacingThe space between children. By default, 0.
elementsA block containing all elements to be included in the row.
-
Declaration
Swift
public var content: ElementContent { get } -
Declaration
Swift
public func backingViewDescription(with context: ViewDescriptionContext) -> ViewDescription?
View on GitHub
GridRow Structure Reference