Background into what I am trying to achieve:
MainViewController presents TableVC. I will tap on a cell to present a DetailVC. With the ability to dismiss by a doneBarButton on the navigation bars on either TableVC or DetailVC.
All doneBarButton's are rooted to the MainViewController so i would think that no matter what the view controllers would dismiss to the MainViewController.
What I am experiencing is a crash upon tapping on my TableVC's doneBarButton but not on my DetailVC's doneBarButton. Because they are all rooted to the MainViewController through interface builder I did not think I should have to code anything in the TableVC's prepareForSegue method however the switch case for the identifier is being highlighted and the debug console outputs
"fatal error: unexpectedly found nil while unwrapping an Optional value"
I'm not entirely sure where to pinpoint what needs fixing, whether that be in the interface builder or including something in the prepareForSegue method.
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
switch segue.identifier! // Line highlighted with error in debug console
{
case "toDetailVC": // Properly presents detailVC through a cell being tapped
default:
break
}
}