<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/GridItem/init(_:spacing:alignment:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI8GridItemV_7spacing9alignmentA2C4SizeO_14CoreFoundation7CGFloatVSgAA9AlignmentVSgtcfc"
  },
  "title" : "init(_:spacing:alignment:)"
}
-->

# init(_:spacing:alignment:)

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

```
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)