title: How to prevent saving images automatically from UIImagePickerController in Swift?
body: <p>I have simple scenario in my app. </p>
  
  <p>I have 1 edit <code>UIButton</code> to select image from Photo Library and show that selected image in <code>UIImageView</code>.</p>
  
  <pre><code>@IBAction func btnEdit(_ sender: UIButton) {
  
      if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.photoLibrary) {
          let picker:UIImagePickerController = UIImagePickerController()
          picker.sourceType = .photoLibrary
          picker.delegate = self
          picker.allowsEditing = true
          picker.sourceType = .photoLibrary
          picker.navigationBar.isTranslucent = false
          self.present(picker, animated: true)
      } else {
          print("Photo Library is not available.")
      }
  
  }
  </code></pre>
  
  <p><strong>UINavigationControllerDelegate &amp; UIImagePickerControllerDelegate</strong></p>
  
  <pre><code>func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
  
      if let pickedimage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
          self.imageView.image = pickedimage
      } else if let pickedimage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
          self.imageView.image = pickedimage
      } else {
          print("Something went wrong while select photo from Library...!")
      }
  
      dismiss(animated: true, completion: nil)
  
  }
  </code></pre>
  
  <p>Its working well. But selected image is saving automatically in tmp folder</p>
  
  <p><strong>I don't want to save in Document directory.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/1AEEp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1AEEp.png" alt="enter image description here"></a></p>
  
  <p>How to stop automatically saving images in Document directory?</p>