I ViewController trying to transfer a picture from the gallery to a new ViewController , but an error occurs
Unexpectedly found a nil while unwrapping an optional value
Code:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { if let im = info[UIImagePickerControllerOriginalImage] as? UIImage { let vc = self.storyboard?.instantiateViewController(withIdentifier: "editImage") as! EditImageViewController vc.imageView.image = im self.present(vc, animated: true, completion: nil) } else { print("Something went wrong") } imagePicker.dismiss(animated: true, completion: nil) } Where is the mistake?