Pass text from textField in UIAlertController to other view
<p>I have a UIAlertController with two textFields : </p>

<pre><code>class ModifiedSearchViewController: UISearchController, UISearchBarDelegate {
    var nameOfOwnPlace = ""
    var adressOfOwnPlace = ""

  func insertYourPLace() {

      let alertController = UIAlertController(title: "Insert New Place", message: "", preferredStyle: UIAlertControllerStyle.Alert)
      let saveAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: {
        alert -&gt; Void in

          let nameTextField = alertController.textFields![0] as UITextField
          let adressTextField = alertController.textFields![1] as UITextField
          self.nameOfOwnPlace = nameTextField.text!
          self.adressOfOwnPlace = adressTextField.text!
          print(self.nameOfOwnPlace)

      })

      let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: {
        (action : UIAlertAction!) -&gt; Void in

      })

      alertController.addTextFieldWithConfigurationHandler { (textField : UITextField!) -&gt; Void in
          textField.placeholder = "Enter Place's Name..."
      }
      alertController.addTextFieldWithConfigurationHandler { (textField : UITextField!) -&gt; Void in
          textField.placeholder = "Enter Adress's Name..."
      }

      alertController.addAction(saveAction)
      alertController.addAction(cancelAction)
      self.presentViewController(alertController, animated: true, completion: nil)

  }
...
}
</code></pre>

<p>I have an other view using my ModifiedSearchViewController class
but I dont succeed to send my strings  (nameOfOwnPlace, adressOfOwnPlace) to the other view</p>

<pre><code> searchController = ModifiedSearchViewController(searchResultsController: resultsViewController)
print(searchController.adressOfOwnPlace)  // nil
</code></pre>

<p>Thanks for any help! :)</p>

<p>EDIT::</p>

<pre><code>var resultsViewController = GMSAutocompleteResultsViewController()
var searchController = ModifiedSearchViewController()

func setSearchViewController() {
            resultsViewController.delegate = self
            searchController = ModifiedSearchViewController(searchResultsController: resultsViewController)
            searchController.searchResultsUpdater = resultsViewController

            print(searchController.adressOfOwnPlace)  // nil
}
</code></pre>