Skip to main content
These iOS-only modifiers refine how individual cells behave inside a Grid. Use them to span columns, anchor a cell within its allocated space, override column-wide alignment, or opt out of grid sizing on an axis. Apply each modifier to the cell view inside a GridRow. gridColumnAlignment is special: applied to one cell, it sets the alignment of the entire column.

gridCellColumns

Makes a grid cell span multiple columns.
number
required
The number of columns this cell should span.
Spanning a header across all columns
Two-column span in a three-column grid

gridCellAnchor

Sets the anchor position for a grid cell within its allocated space.
UnitPoint
required
The anchor point within the cell. A UnitPoint where { x: 0, y: 0 } is the top-leading corner and { x: 1, y: 1 } is the bottom-trailing corner. You can also use string presets like "center", "topLeading", "bottomTrailing", etc.
Positioning a cell at the top-leading corner
Custom anchor point

gridColumnAlignment

Overrides the horizontal alignment for an entire grid column.
HorizontalAlignment
required
The horizontal alignment for the column. One of "leading", "center", or "trailing".
Right-aligning a column
Mixed column alignments
This modifier is applied to a cell in any row and affects the alignment of the entire column across all rows. You only need to apply it to one cell per column.

gridCellUnsizedAxes

Opts a grid cell out of being sized along specified axes, using its ideal size instead.
Axis
required
The axes along which the cell should use its ideal size instead of the grid-assigned size. See Axis.
Using ideal width in a grid cell
Using ideal height in a grid cell
By default, grid cells expand to fill the space allocated by the grid. This modifier lets a cell opt out of that behavior on one or both axes, using its intrinsic (ideal) size instead.

See also

  • Grid — the grid layout container
  • GridRow — a row within a grid
  • Axis — axis values
  • UnitPoint — anchor point values