I've a function, getSemainesStages() which read a distant json file and put the result in a (global scope) array.
The problem is that it's asynchronous like somebody explain to me and I need this array to populate a pickerView datasource.
So when I call:
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return lesSemaines.count
}
The array is still empty, and the same for
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return lesSemaines[row]
}
How can I do that only after my getSemainesStages() function is empty ?