I have 5 UIViewControllers that I want to pass data from one UIViewController to another. So basically the 3rd - 5th UIViewController is to capture a picture and send it to the server. After that I want to send the preview back to the 2nd UIViewController but unfortunately it didn't work because my UIImageView in the 2nd UIViewController still showing an empty image.
Here's my code to pass the image back to the 2nd UIViewController :
func showSuccessPopUp() {
        let destinationVC = VehiclePhotoSuccessPopUpVC(nibName: "VehiclePhotoSuccessPopUpVC", bundle: nil)
        destinationVC.modalPresentationStyle = .overCurrentContext
        destinationVC.okTapped = { (sender) in
            self.dataPass.image = self.photoImage // Passing the image to the model
            let destinationVC = self.navigationController?.viewControllers[3] as! RestructureFormVC
            destinationVC.source = "previewPhoto" // A string for knowing where the source is in the 2nd UIViewController
            destinationVC.dataPass = self.dataPass // Passing the model to the 2nd UIViewController
            self.navigationController?.popToViewController(destinationVC, animated: true)
        }
        self.present(destinationVC, animated: false, completion: nil)
    }
I'm not sure where did I do wrong because I'm still new in iOS development. If you need more code feel free to ask and I will provide it to you. Any help would be appreciated. Thank you.
 
    
 
    