Created
May 26, 2021 04:33
-
-
Save anupamchugh/6f1a30a2b84d95f06e7613b8c76098ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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