I have two pickerViews in ViewController and a Struct where I made a function which will get data of PickerViews. In didSelectRow func of PickerView I wrote the below code.
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if pickerView == fromPickerViewRolled {
let optionArray1 = currencyManager.currencyArrayOption1[row]
}
else if pickerView == toPickerViewRolled {
let optionArray2 = currencyManager.currencyArrayOption2[row]
}
}
How may I get the data of optionArray1 and ..Array2 outside of if/else so that I can use in function. Any help would be appreciated. Looking forward for an answer.
Aucun commentaire:
Enregistrer un commentaire