this is my code
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var madLibInput: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "completedSenteceSegue" {
let nvc = segue.destination as! SecondViewController
nvc.passedInput = madLibInput.text
}
}
}
the other viewcontroller is this:
import UIKit
class SecondViewController: UIViewController {
@IBOutlet weak var myUncleWantsToText: UILabel!
var passedInput: String!
override func viewDidLoad() {
super.viewDidLoad()
myUncleWantsToText.text = "My uncle wants to go to the \(passedInput)"
}
}
The text ends up as "My uncle wants to go to the nil" regardless of input. Also it gives this warning: "String interpolation produces a debug description for an optional value; did you mean to make this explicit?" I don't know why either of these are happening.
Most likely, the segue identifier in the code does not match the "storyboard" one.