---
title: "init(rows:alignment:spacing:pinnedViews:content:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/lazyhgrid/init(rows:alignment:spacing:pinnedviews:content:)"
---

# init(rows:alignment:spacing:pinnedViews:content:)

Creates a grid that grows horizontally.

## Declaration

```swift
nonisolated init(rows: [GridItem], alignment: VerticalAlignment = .center, spacing: CGFloat? = nil, pinnedViews: PinnedScrollableViews = .init(), @ContentBuilder content: () -> Content)
```

## Parameters

- `rows`: An array of grid items that size and position each column of the grid.
- `alignment`: The alignment of the grid within its parent view.
- `spacing`: The spacing between the grid and the next item in its parent view.
- `pinnedViews`: Views to pin to the bounds of a parent scroll view.
- `content`: The content of the grid.
