For example, I have one TextField in each ViewController. By clicking on the button, you move to another ViewController and the data from the first TextField is copied to the second TextField.
1 answer
Use prepareForSegue
. Pass the string to the second VC:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "YOURIDENTIFIER" { if let destinationVC = segue.destinationViewController as? SecondViewController { destinationVC.textToShow = firstTF.text } } }
And in the second you use as you need. Install the text:
secondVC.text = textToShow
|