title: Using an alert to choose between image gallery or camera in UIImagePickerController
body: <p>I have an UIImagePickerController that works, but I wanted to let the user decide whether he shoots the image or picks it from library. So this is my code trying to do it with alert:</p>
  
  <pre><code>    @IBAction func cameraButton(_ sender: UIButton) {
      picker.allowsEditing = true
      let alert = UIAlertController(title: "Choose one of the following:", message: "", preferredStyle: UIAlertControllerStyle.alert)
      alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { action in
              self.picker.sourceType = .photoLibrary
      }))
      alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { action in
          self.picker.sourceType = .camera
      }))
      self.present(alert, animated: true, completion: nil)
      present(picker, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>However, once I click on one of the actions in the alert, nothing happens, it just gets out of the alert but not presenting my picker</p>
  
  <p>Any help is appreciated</p>