I googled how to find the list of the countries and trying to implement into PickerView
, but I am stuck at this point where I try to do countries.count
You need to return array count in method numberOfRowsInComponent
and in the titleForRow
you need to return array object, show that it will show in picker.
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return countries.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return countries[row]
}