How to create a 2 column scrollview

24 views Asked by At

I have created an app with a feed like you can see in Instagram or ticket: one column:

Below is the code:

struct PostsFeedView: View {
    var body: some View {
        ScrollView {
            LazyVStack(spacing: 32) {
                ForEach(Post.MOCK_POSTS) { post in
                    PostCellView(item: post)
                }
            }
        }
    }
}

which look like this:

enter image description here

I am trying to make it looks like different as shown in the image below:

enter image description here

So 2 column and each post can be either a square shape or vertical rectangle. For now, the choice between square and rectangle shape can be random

Any idea how to do it ?

Thanks

0

There are 0 answers