How to add a button that overrides a storyboard segue (in swift 3)

I added a storyboard segue to add text to a photo. Right now you would have to go through 3 view controllers to get the final photo. A(options menu) → B(enter text) → C(take photo). If I add a button to vc b it shows up as a sigabrt error. If I comment out the code below there is no error. Its obvious the issue is the storyboard segue. All i want to do is have a button that can go from b->a without a runtime error coming up. The code below is vc b. Just to let you know I can go from c ->a no problem but I want to go from b → a

import ukit
class customViewController: UIViewController {

@IBOutlet weak var zext: UITextField!
override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
var destviewc: ccViewController = segue.destination as! ccViewController
destviewc.labelText = zext.text!


} }

My guess is that you are not using an unwind segue, and that you are creating another copy of view controller A that is pushed to the navigation stack? You should maybe be using an unwind segue, and you can find out more about them in this tutorial.

It seems as if you have A->B and when you segue you create A->B->A - perhaps something in A is not initialised correctly the second time? Can’t say without seeing some debug output. How do you go from C->A? What is the contents of navigationController.viewControllers when you do?