I'm trying to append to an array via segue:
@IBOutlet weak var addTextTextField: UITextField!
@IBAction func addTextButton(_ sender: UIButton)
{
performSegue(withIdentifier: "addTextSegue", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
let mainViewController = segue.destination as! MainViewController
mainViewController.array.append(addTextTextField.text!)
}
Its only appending to the array once, the next time I try, it overwrites the last entry. What is the reason for this?