0

does anyone have an idea how can i break Vertical ScrollView into small horizontal ScrollView using SwiftUi:

I have the code bellow which displays the youtubeResults vertically, since each item of the ForEach is smaller, so i want to group them by 3 itens Horizontally , then the following 3 itens goes bellow them vertically until the forEach ends.

I would like the results to be displayed like that(with images, this is just an example):

(Justin beiber) (Drake) (Omarion)

(Mandela) (Dj Khaled) (Nirvana)

(Justin beiber) (Prince) (Adele)

My code: Displaying the results one by one Vertically

 ScrollView (.vertical, showsIndicators: false, content:{
                    
                    LazyVStack(spacing : 25){
                        
                        ForEach(getData.youtubeResults){ result in
                            
                            SideItemView(youtubeResults: result, selectedTheme: self.$selectedTheme)
                        }
                    }
                    .padding()
                    .padding(.top)
                })
pawello2222
  • 46,897
  • 22
  • 145
  • 209

1 Answers1

1

As stated by Asperi, LazyVGrid or LazyHGrid was the soulution, introduced by Apple in IOS 14+.