As you find, you need to implement numberOfComponents(in:).
Your numberOfComponentsInPickerView(pickerView: UIPickerView) -> Intneed to change to:
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
Also you need to change your pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?:
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerData[row]
}
In Swift 3, many methods are renamed. Check out the last link and be careful with this . And you better notice the version of Xcode in your question.
Ooper source
share