In the source controller in prepare for segue you set a property on your destination controller:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let detailViewController = segue.destination as? DetailViewController {
detailViewController.titleText = mylabel.text
}
}
In your destination controller's view did load you assign this property to your label field.
var titleText = ""
override func viewDidLoad() {
super.viewDidLoad()
label.text = titleText
}
Note you cannot assign directly to your label in prepareForSegue because the label is not guaranteed to have been initialized until ViewDidLoad has been called. Thats why the value goes into a property. Proper model view separation also dictates that one controller shouldn't be writing to another controller's view anyways.