I am working through hackingwithswift doing the 100 Days of SwiftUI and currently on Day 35 which needs me to build a times table app.
Unfortunately, I have got stuck at a very early stage and feel stupid asking.
How can I make my array index start at 1 rather than 0?
Below is my code and screenshot of the canvas:
struct ContentView: View { @State private var number = 0 @State private var question = Int.random(in: 0..<13) let numberRange = Array<Int>(1 ... 12) var body: some View { VStack { Picker("What times tables do you want to test your knowledge on?", selection: $number) { ForEach(0 ..< numberRange.count) { Text("\(self.numberRange[$0])") } } .pickerStyle(SegmentedPickerStyle()) Text("What is \(number) x \(question) = ") } } } 