Hello,
I have a Swift view that incorporates a Scroll View. It displays the correct data and allows me to move through the associated items with the mouse. What it does not do is allow me to use the keyboard buttons such as arrow up, arrow down, page up and page down. I am at a loss on how to incorporate this functionality into my view. Any guidance would be appreciated.
Below is my code.
Regards,
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.csvData.count
let numElementsPerArray = principalData.csvData[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
returnRectangle(theRow: row, theCol: col, principalData: principalData)
}
}
}.padding(.bottom, -7.5)
ScrollView{
LazyVGrid(columns: columns, alignment: .center, spacing: 0
)
{
ForEach(1..<numArrays) {row in
ForEach(0..<numElementsPerArray) {col in
returnRectangle(theRow: row, theCol: col, principalData: principalData)
}
}
}
ForEach(0..<30){index in
Text("")
}
}// end scrollview
}
}
}