LazyVGrid & Swift Playgrounds

I wrote this code in swift Playgrounds

import SwiftUI

import PlaygroundSupport



struct ContentView: View {

    var body: some View {

        Home()

    }

}

struct ContentView_Previews: PreviewProvider {

    static var previews: some View {

        ContentView()

        }

    }

    

struct Home : View {

    var body: some View {

        VStack {

            LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 15), count: 3), spacing: 15) {

                ForEach(0..<9,id:\.self){index in

                        Color.white

                    }

                }

            }

        }

    }



PlaygroundPage.current.setLiveView(ContentView())

and at lines witch contains LazyVGrid there is an error?

Is it possible having LazyVGrid in Playgrounds?

Replies

I don’t think Swift Playgrounds has Swift 5.3 yet, so no new features from SwiftUI this year.