Skip to content

Instantly share code, notes, and snippets.

@gallaugher
Created June 22, 2018 00:48
Show Gist options
  • Select an option

  • Save gallaugher/796c418d35f92b607ab85e1f451d75a5 to your computer and use it in GitHub Desktop.

Select an option

Save gallaugher/796c418d35f92b607ab85e1f451d75a5 to your computer and use it in GitHub Desktop.
cameraOrLibraryAlert
func cameraOrLibraryAlert() {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let cameraAction = UIAlertAction(title: "Camera", style: .default) { _ in
self.accessCamera()
}
let photoLibraryAction = UIAlertAction(title: "Photo Library", style: .default) { _ in
self.accessLibrary()
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
alertController.addAction(cameraAction)
alertController.addAction(photoLibraryAction)
alertController.addAction(cancelAction)
present(alertController, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment