I have a picker loaded with an array of strings, I want to change means appending or editing strings by typing in the text field and save in that array and display that changes in that picker view.Thanks in advance.
extension ViewController: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
addIntoArray(text: textField.text)
}
func addIntoArray(text: String?) {
guard let text = text, text.count > 0 else {
//for blannk or nil string
return
}
listArray.append(text)
//reload the picker
picker.reloadAllComponents() //picker is the instanc of your pickerView
}
}
try this