DevTechie
Published in

DevTechie

New in SwiftUI 4: Grid View

Photo by charlesdeluvio on Unsplash

SwiftUI 4 brought in a new container view called Grid view. A Grid is a container view which gives us a two-dimensional layout by arranging its child views in rows and columns.

We create a layout by initializing Grid with a collection of GridRows. Let’s create an example to understand better:

struct ContentView: View {
var body: some View {
VStack {
Grid {

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store