> For the complete documentation index, see [llms.txt](https://betty-dev.gitbook.io/cutting-edge-swiftui-apps/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://betty-dev.gitbook.io/cutting-edge-swiftui-apps/start-with-layout/grid.md).

# Grid

Grid is a new container view that arranges views in a two-dimensional grid.&#x20;

Grid will measure its subviews up front to enable cells that span multiple columns and enable automatic alignments across rows and columns.

This particular grid view contains two GridRow instances.\
Within a row, each view corresponds to a column.<br>

🔥 In `contentView` add a second tab&#x20;

// Create a Grid View

**import** Charts

**import** SwiftUI

<br>

**struct** ContentView: View {

&#x20;   @State **private** **var** selection = 2

&#x20;  &#x20;

&#x20;   **var** body: **some** View {

&#x20;       TabView(selection: $selection) {

&#x20;           WinesTab()

&#x20;               .tabItem {

&#x20;                   Label("Wines", systemImage: "chart.bar.doc.horizontal")

&#x20;               }

&#x20;               .tag(1)

&#x20;           <mark style="color:orange;">Grid {</mark>

&#x20;               <mark style="color:orange;">GridRow {</mark>

&#x20;                   <mark style="color:orange;">ParisDetailsChart()</mark>

&#x20;                       <mark style="color:orange;">.gridCellColumns(2)</mark>

&#x20;               <mark style="color:orange;">}</mark>

&#x20;               <mark style="color:orange;">GridRow {</mark>

&#x20;                   <mark style="color:orange;">AmsterdamDetailsChart()</mark>

&#x20;                   <mark style="color:orange;">SalesDetailsChart()</mark>

&#x20;               <mark style="color:orange;">}</mark>

&#x20;           <mark style="color:orange;">}</mark>

&#x20;               <mark style="color:orange;">.tabItem {</mark>

&#x20;                   <mark style="color:orange;">Label("Overview", systemImage: "square.grid.2x2")</mark>

&#x20;               <mark style="color:orange;">}</mark>

&#x20;               <mark style="color:orange;">.tag(2)</mark>

&#x20;       }

&#x20;   }

}

<br>

**struct** ContentView\_Previews: PreviewProvider {

&#x20;   **static** **var** previews: **some** View {

&#x20;       ContentView()

&#x20;   }

}

```swift
// Example

struct WeatherDetailView: View {
    var body: some View {
        Grid {
            GridRow {
                NameHeadLine()
                    .gridCellColumns(2)
            }
            GridRow {
                CalendarIcon()
                SymbolGrid()
            }
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://betty-dev.gitbook.io/cutting-edge-swiftui-apps/start-with-layout/grid.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
