---
title: "init(_:spacing:alignment:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/griditem/init(_:spacing:alignment:)"
---

# init(_:spacing:alignment:)

Creates a grid item with the specified size, spacing, and alignment.

## Declaration

```swift
init(_ size: GridItem.Size = .flexible(), spacing: CGFloat? = nil, alignment: Alignment? = nil)
```

## Parameters

- `size`: The size of the grid item.
- `spacing`: The spacing to use between this and the next item.
- `alignment`: The alignment to use for this grid item.
