Hello,
I have code that creates a view with two LazyVGrids in a VStack. Unfortunately there is a gap between the LazyVGrids that I would like to eliminate. Any suggests would be appreciated.
Below is my code.
Chris
import SwiftUI
struct SecondView: View {
var columns = [
GridItem(.fixed(100), spacing: 0.1),
GridItem(.fixed(100), spacing: 0.1),
GridItem(.fixed(100), spacing: 0.1),
GridItem(.fixed(100), spacing: 0.1),
GridItem(.fixed(100), spacing: 0.1)
]
let principalData: convertCSVtoArray
var body: some View {
let numArrays = principalData.cvsData.count
let numElementsPerArray = principalData.cvsData[0].count
VStack{
Text("")
Text("Historical Data")
.font(.title)
.padding(5)
Divider()
LazyVGrid(
columns: columns,
alignment: .center,
spacing: 0)
{
ForEach(0..<1) {row in
ForEach(0..<numElementsPerArray) {col in
Rectangle()
.foregroundColor(.white)
.overlay (Text(principalData.cvsData[row][col]).bold())
.frame(height: 30)
.border(Color.gray, width: 2)
}
}
}
ScrollView{
LazyVGrid(
columns: columns,
alignment: .center,
spacing: 0)
{
ForEach(1..<numArrays) {row in
ForEach(0..<numElementsPerArray) {col in
Rectangle()
.foregroundColor(.white)
.overlay (Text(principalData.cvsData[row][col]))
.frame(height: 30)
.border(Color.gray, width: 0.5)
}
}
}
ForEach(0..<30){index in
Text("")
}
}// end scrollview
}
}
}