So far I have tried to use
func pickerView1(_ helpTypePicker: UIPickerView, didSelectRow row: Int, inComponent component: Int { infoListInit.requestInfoList[4] = (helpTypePickerValues[row]) }
But the value is just not saving to the array. I tried printing the value after saving it, but to no avail. I do have helpTypePicker as a self delegate in my viewDidLoad func, so I don't know where to go from here. Other text values from UITextFields save fine, but none of my UIPickerViews are working in this regard
Here is the full class:
import Foundationimport UIKitclass requestHelpTypePickerScreen: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {func numberOfComponents(in pickerView: UIPickerView) -> Int { return 1}func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { if pickerView.tag == 1 { return helpTypePickerValues.count } else { return languagePickerValues.count }}func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { if pickerView.tag == 1 { return "\(helpTypePickerValues[row])" } else { return "\(languagePickerValues[row])" }}// Mark: outlets@IBOutlet weak var helpTypePicker: UIPickerView!@IBOutlet weak var languagePicker: UIPickerView!@IBOutlet weak var helpTypePickerLabel: UILabel!let helpTypePickerValues = ["Academic/Professional", "Donate", "Food/Groceries", "Medication", "Emotional Support", "Misc."]let languagePickerValues = ["Arabic", "Chinese", "Spanish", "English", "French", "Hindi/Urdu", "Korean", "Russian"]override func viewDidLoad() { super.viewDidLoad() helpTypePicker.delegate = self languagePicker.delegate = self self.helpTypePicker.selectRow(2, inComponent: 0, animated: true) self.languagePicker.selectRow(3, inComponent: 0, animated: true)}// Mark: actions@IBAction func buttonPressed(_ sender: Any) { func pickerView(_ helpTypePicker: UIPickerView, didSelectRow row: Int, inComponent component: Int) { infoListInit.requestInfoList[5] = (helpTypePickerValues[row]) } // this is called pickerView1 because it would conflict with the above // function if called pickerView func pickerView1(_ languagePicker: UIPickerView, didSelectRow row1: Int, inComponent component: Int) { infoListInit.requestInfoList[6] = (languagePickerValues[row1]) } performSegue(withIdentifier: "pickersDone", sender: nil)}