I am working on an application which it access to the camera and it can take photos. the problem is that it dose not save the image to the camera roll as soon as it takes it. I searched a lot and it seems I should implement an image view but I do not need the exact image on the screen of my application. Is there any way which I can save image to camera roll as soon as I take it without using of imageView?
Here is my code for imagePickerController
@IBAction func openCameraButton(_ sender: AnyObject)
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
imagePicked.contentMode = .scaleToFill
imagePicked.image = pickedImage
}
picker.dismiss(animated: true, completion: nil)
}