Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created May 26, 2021 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/6f1a30a2b84d95f06e7613b8c76098ce to your computer and use it in GitHub Desktop.
Save anupamchugh/6f1a30a2b84d95f06e7613b8c76098ce to your computer and use it in GitHub Desktop.
extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
picker.dismiss(animated: true)
guard let uiImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage else {
fatalError("Error!")
}
imageView.image = uiImage
createVisionRequest(image: uiImage)
}
private func presentPhotoPicker(sourceType: UIImagePickerController.SourceType) {
let picker = UIImagePickerController()
picker.delegate = self
picker.sourceType = sourceType
present(picker, animated: true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment