GridLayout

A grid that you can use in conditional layouts.

StructureiOS 16.0+macOS 13.0+tvOS 16.0+watchOS 9.0+GridLayout in SwiftUI

Declaration

React
type GridLayout = { alignment?: Alignment; horizontalSpacing?: number | null; verticalSpacing?: number | null; };
Swift
@frozen nonisolated struct GridLayout

Properties

  • alignmentAlignment

    The alignment of subviews.

  • horizontalSpacingnumber | null

    The horizontal distance between adjacent subviews.

  • verticalSpacingnumber | null

    The vertical distance between adjacent subviews.

Overview

This layout container behaves like a Grid, but conforms to the Layout protocol so you can use it in the conditional layouts that you construct with AnyLayout. If you don't need a conditional layout, use Grid instead.

From Apple’s SwiftUI documentation. Code samples there are Swift.

See also

More in Layout.