I want to loop through an array of items and display 3 of them in one HStack for every other item in the array I want to display them in the next line again for 3 items and so on.
It should look something like this:

My code so far lets the items appear in the same line:
struct FeedBlockView: View {
let cardSize = (UIScreen.main.bounds.size.width / 3) - 1
@State var feedPosts: [FeedPost]
var body: some View {
HStack(spacing: 2) {
ForEach(feedPosts, id: \.id) { feedPost in
WebImage(url: URL(string: feedPost.feedImageUrl))
.resizable()
.frame(width: cardSize, height: cardSize)
}
}
}
}