I just created an extension to do this you should be able to just add it to your code and hook up the outlet to what ever triggers the image picker in your app.
// MARK: - UIImagePickerControllerDelegate Methods
extension UIViewController:UIImagePickerControllerDelegate, UINavigationControllerDelegate{
@IBAction func newImgTapped(sender: UIButton) {
let imgPicker = UIImagePickerController()
imgPicker.delegate = self
let status = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo)
if status == AVAuthorizationStatus.Denied{
let changeYourSettingsAlert = UIAlertController(title: "You do not have permissions enabled for this.", message: "Would you like to change them in settings?", preferredStyle: .Alert)
let okAction = UIAlertAction(title: "OK", style: .Default, handler: { (UIAlertAction) -> Void in
guard let url = NSURL(string: UIApplicationOpenSettingsURLString) else {return}
UIApplication.sharedApplication().openURL(url)
print("opensettings")
})
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
changeYourSettingsAlert.addAction(okAction)
changeYourSettingsAlert.addAction(cancelAction)
presentAlert(changeYourSettingsAlert)
} else {
let Alert = UIAlertController(title: "Where would you like to get photos from?", message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)
Alert.popoverPresentationController?.sourceRect = sender.bounds
Alert.popoverPresentationController?.sourceView = sender
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
imgPicker.allowsEditing = true
imgPicker.modalPresentationStyle = UIModalPresentationStyle.Popover
imgPicker.popoverPresentationController?.sourceView = sender
imgPicker.popoverPresentationController?.sourceRect = sender.bounds
presentAlert(Alert)
let camera = UIAlertAction(title: "Take a Photo", style: .Default) { (camera) -> Void in
imgPicker.sourceType = .Camera
self.presentViewController(imgPicker, animated: true, completion: nil)
}
let photoLibrary = UIAlertAction(title: "Choose from Library", style: .Default) { (Photolibrary) -> Void in
imgPicker.sourceType = .PhotoLibrary
self.presentViewController(imgPicker, animated: true, completion: nil)
}
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
Alert.addAction(camera)
}
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){
Alert.addAction(photoLibrary)
}
Alert.addAction(cancelAction)
}
}
public func presentAlert(sender:UIAlertController){
presentViewController(sender, animated: false, completion: nil)
}
public func imagePickerControllerDidCancel(picker: UIImagePickerController) {
dismissViewControllerAnimated(true, completion: nil)
}
}
hope that helps.