When I press the back button in this navigation controller, I want to send the state of the switches to variables in a different View Controller. However, the prepareForSegue method is not being called. How do I fix this?
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
print("here")
let secondViewController:ViewController2 = segue.destination as! ViewController2
if undoSwitch.isOn {
secondViewController.undoControls[0] = true
}
else {
secondViewController.undoControls[0] = false
}
}