My UIPickerView with four components gives me this back when I'm trying to build it. What should I do I mean I made the number Of Rows one Point bigger because in Swift numbers start at 0 but nothing worked.... What is the problem?
let componentOne = [1...1000]
let componentTwo = [1...59]
let componentThree = [1...59]
let componentFour = [1...10]
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 4
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if component == 0 {
return 1000
}
if component == 1 {
return 59
}
if component == 2 {
return 59
}
if component == 3 {
return 10
}
return component
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if component == 0 {
_ = componentOne[row]
return "\(1000)"
}
if component == 1 {
_ = componentTwo[row]
return "\(59)"
}
if component == 2 {
_ = componentThree[row]
return "\(59)"
}
if component == 3 {
_ = componentFour[row]
return "\(10)"
}
return nil
}
componentOneanArray?if component == 0 {[1...10]is an array of one range, not an array of 10 integers.