How to send values to a parent view controller in Swift
<p>I am working on a settings view controller screen for my iOS app written in swift. I am using a navigation controller to run the main settings table view which shows the cell titled, "Input Method." The current method is listed on the right of the cell. They can click the cell to go to the next view controller where they can select the input method that they'd like.</p>

<p>From here, there are two sections. The first is the input method to choose (touchscreen or joystick). The second section is joystick specific on whether or not the person is a lefty or righty. I don't want to have the vc unwind when they choose one box because they may choose one in another section too.</p>

<p>My question: How can I update the text field in the parent controller from the child controller.</p>

<p>Problems I'm having for optional solutions:</p>

<pre><code>let parentVC: UIViewController = (self.navigationController?.parentViewController)!
parentVC.inputMethod.text? = cellSelected // This doesn't work because it cannot find the label inputMethod.
</code></pre>

<p>viewDidLoad() will cause a lag and the user sees the old method before it changes.</p>

<p>I cannot find out how to run a segue when someone clicks the back button at the upper left hand side in the navigation controller, since the navigation controller controls the segue.</p>