Hi. I'm new to swift and IOS development. I've just been messing around with swift just to get a better understanding of it and I'm a bit confused on something. I have the following code in my app.
let arr = [1,2,3,4,5,6,7,8,9,2,3,5]
var lo: [GridItem] = [
GridItem(.adaptive(minimum: 3, maximum: 10)),
GridItem(.adaptive(minimum: 3, maximum: 10)),
GridItem(.adaptive(minimum: 3, maximum: 10))
]
var body: some View {
ScrollView {
LazyHGrid(rows: lo, spacing: 50, content: {
ForEach(arr, id: \.self) { item in
Text(String(item)).padding()
}
})
}
}
I'm expecting it to display a grid displaying every item in the array arr, but it only displays the items up to the 9th element. If someone could explain why this is, that would be great. Here is a screenshot of the output: