title: Cannot access data passed through delegate
body: <p>I am trying to understand delegate and I don't get why it says that I have used unresolved identifier 'data'.</p>
  
  <pre><code>//This is my sendingVC
  
  import UIKit
  
  protocol TextFieldDelegate {
  func userEnteredText(text: String)
  }
  
  class ViewController: UIViewController {
  
  
  @IBOutlet weak var textField: UITextField!
  
  var delegate: TextFieldDelegate? = nil
  
  override func viewDidLoad() {
      super.viewDidLoad()
  }
  
  
  @IBAction func sendButton(_ sender: AnyObject) {
      if delegate != nil {
          if textField.text != nil {
              let data = textField.text
              delegate?.userEnteredText(text: data!)
          }
      }
  }
  
  }
  </code></pre>
  
  <p>The problem is with this code below for my receivingVC I am not able to accesss data variable which should be passed by the delegate.</p>
  
  <pre><code>//This is my receivingVC
  import UIKit
  
  class SecondViewController: UIViewController, TextFieldDelegate {
  
  @IBOutlet weak var label: UILabel!
  override func viewDidLoad() {
      super.viewDidLoad()
  
  }
  
  func userEnteredText(text: String) {
      label.text = data // Use of unresolved identifier 'data'
  }
  
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == "sendSegue" {
          let destVC: ViewController = segue.destination as! ViewController
          destVC.delegate = self
      }
  }
  
  }
  </code></pre>