title: swift 4- Save the last data of a text field in a label so that they are displayed when the app is restarted
body: <p>I have a problem, I want to create a small app in which data in a formula can be charged.</p>
  
  <p>Currently the data from three ViewControllers and one PickerViewController will be given back to the first ViewController.
  That works very well too.</p>
  
  <p>Now I want that the data at the start not on "nil" set but have a certain value.
  Thereafter, the data entered last should reappear when the app is restarted.</p>
  
  <p>I would like to apologize for my english, it is not my preferred language ...</p>
  
  <p>Here is a part of my code how I wrote it</p>
  
  <p>Main ViewController:</p>
  
  <pre><code>import UIKit
  
  
  
  class RecivingViewController: UIViewController, SendDataBack, SendDataBack2, SendDataBack3, SendDataBack4 {
  
  @IBOutlet weak var recivingData: UILabel!
  @IBOutlet weak var recivingData2: UILabel!
  @IBOutlet weak var recivingData3: UILabel!
  @IBOutlet weak var recivingData4: UILabel!
  
  
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  }
  
  func userData(data: String) {
      recivingData.text = data
  }
  
  func userData2(data: String) {
      recivingData2.text = data
  }
  
  func userData3(data: String) {
      recivingData3.text = data
  }
  func PickerData(data: String){
      recivingData4.text = data
  }
  
  
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == "view1" {
          let SendingVC: SendingViewController = segue.destination as! SendingViewController
          SendingVC.delegate = self 
      }
  
      if segue.identifier == "view2" {
          let SendingVC2: Sending2ViewController = segue.destination as! Sending2ViewController
          SendingVC2.delegate = self
      }
  
      if segue.identifier == "view3" {
          let SendingVC3: Sending3ViewController = segue.destination as! Sending3ViewController
          SendingVC3.delegate = self
      }
  
      if segue.identifier == "picker" {
          let SendingVC4: PickerViewController = segue.destination as! PickerViewController
          SendingVC4.delegate = self
      }
  
  
  }
  }
  </code></pre>
  
  <p>one of the other ViewControllers:</p>
  
  <pre><code>import UIKit
  
  protocol SendDataBack {
      func userData(data: String)
  
  
    }
  
  class SendingViewController: UIViewController {
  
  @IBOutlet weak var DataTxt: UITextField!
  var delegate: SendDataBack? = nil
  
  
  
  
  @IBAction func done(_ sender: Any) {
      if delegate != nil {
          if DataTxt.text != nil {
              let data = DataTxt.text
              delegate?.userData(data: data!)
              dismiss(animated: true, completion: nil)
          }
      }
  }
  </code></pre>