I am working on a custom camera application where I present 3 viewing modes. At each step, I pass data using the prepareForSegue function. My problem is that after completing the work with the camera, I need to show 2 more viewing modes that should be inside the navigation controller.
I realized that if I do not transmit any data, the navigation controller works fine. However, when I transfer data, the application crashes at runtime. What is the right way to do this?
Here is my preparation for the segue function;
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "camera2Crop"{
let controller: CropViewController = segue.destinationViewController as CropViewController
controller.photoTaken = self.photoTaken
}
}
where photoTakenis the object UIImage. Moreover, here is a screenshot from my storyboard where I put the navigationController. I call the function prepareForSeguein CustomCameraViewControllerto go to CropViewController.

EDIT: I changed my preparation method for the following code:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "camera2Crop" {
let controller: CustomNavigationController = segue.destinationViewController as CustomNavigationController
controller.photoTaken = self.photoTaken
}
}
Now the application does not crash, but I do not know how to send an object through the navigation controller
source
share