A couple of weeks ago I asked this question and got a very detailed explanation. Now I would like to pass data back to the first ViewController but I keep getting stuck using the same method. I have a modal of the first VC to the second, where I would like to edit an array of strings, which will be showed on the first view again. So on my first view I have an array of data, which should be passed to the second so edit fields show the current information after which the user has to be able to edit the contents of the array and pass that data back to the first where it is shown on labels. I'm using Swift.
My code:
(in ViewController.swift:)
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
let secondVC = segue.destinationViewController as SecondViewController
secondVC.namesPlayers = self.namesPlayers
}
(in SecondViewController.swift:)
override func viewDidLoad() {
super.viewDidLoad()
labelFirstPlayer.text = namenSpelers[0]
}
Thank you