Good day,
I get an error “The requested index was outside the bounds of the array.” How do I solve it? Here is my code:
import SwiftUI
struct ContentView: View {
@State var first: [String] = ["Hello Jamie!","Hello John!","Hello Justin!"]
@State var dates: [String] = ["21","22","23"]
@State var numberIam: Int = 0
var body: some View {
VStack {
ForEach(first, id: \.self) { item in
Text(item)
.onAppear{
numberIam = numberIam + 1
}
Text(dates[numberIam])
}
}
}
}
Thank You!