Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example for using Rx extension with UIImagePickerController
let imagePicker = UIImagePickerController()
imagePicker.rx.didFinishPickingMediaWithInfo.subscribe(onNext: { [unowned self] info in
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
self.imageView.contentMode = .scaleAspectFit
self.imageView.image = pickedImage
self.dismiss(animated: true, completion: nil)
imagePicker.rx.didCancel.subscribe(onNext: { [unowned self] in
self.dismiss(animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment