# How to take a saved string and use it another view controller in swift?

**URL:** <https://forums.kodeco.com/t/how-to-take-a-saved-string-and-use-it-another-view-controller-in-swift/23951>\
**Category:** Swift\
**Created:** [December 9, 2016, 11:18pm UTC](https://forums.kodeco.com/t/how-to-take-a-saved-string-and-use-it-another-view-controller-in-swift/23951 "2016-12-09T23:18:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zalubski](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/zalubski/32/81494_2.png) [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Post date:** [December 9, 2016, 11:18pm UTC](https://forums.kodeco.com/t/how-to-take-a-saved-string-and-use-it-another-view-controller-in-swift/23951/1 "2016-12-09T23:18:26Z")

</div>

The text below here uses a uitextield and saves it to a label. Lets say this is view controller A. I am passing through a to b view controller using a simple button

```
import UIKit

class ViewController: UIViewController {

@IBOutlet weak var text: UITextField!
@IBOutlet weak var labelz: UILabel!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

}

@IBAction func ritaOra(_ sender: Any) {
labelz.text = text.text
UserDefaults.standard.set(labelz.text, forKey: "myName")
text.text = ""

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
 }
override func viewDidAppear(_ animated: Bool) {
if let x = UserDefaults.standard.object(forKey: "myName") as? String
{
labelz.text = x

}
}

```

This code below is what I use in a camera. Lets say this is view controller b.

```
let text = "Python"
let label = UILabel(frame: CGRect(x: 125, y: 400, width: self.view.frame.width, height: 300))
label.font = UIFont(name: label.font.fontName, size: 122)

label.textColor = UIColor.blue
 label.alpha = 0.3
 label.text = text

```

How can I take the textview in view controller a and place into where let text = “Python” (in view controller b) is currently.
