What I want to achieve:
User presses the button in the ViewController then, the color of the button placed in the container view should change its color to red.
I recommend not to rely on segue.identifier
, but rather test for destination
type directly:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
if let vc = segue.destination as? YourViewController {
vc.someVariable = true
}
}
This way you avoid mistakes with a misspelled segue name.