Adding a selection confirmation to PHPickerViewController

526 Views Asked by At

I'm implementing the new PHPickerViewController as follows:

func importMedia() {
    var config = PHPickerConfiguration()
    config.selectionLimit = 1
    //config.filter = PHPickerFilter.images

    let pickerViewController = PHPickerViewController(configuration: config)
    pickerViewController.delegate = self
    self.present(pickerViewController, animated: true, completion: nil)
}

And:

func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
    picker.dismiss(animated: true) {
        // Handle resultant media
    }
}

Is there any way to get some form of confirmation dialog to the user when they select a photo/video? As it stands, tapping media just instantly dismisses the PHPickerViewController and handles the selected media accordingly, whereas with my previous UIImagePickerController implementation, after tapping a photo/video it would then show a preview dialog with a "cancel" and "choose" button at the bottom. I assume this may have something to do with using picker.allowsEditing = true for that implementation - does something similar exist with PHPickerViewController?

I guess I could add a UIAlertController in the delegate method, before handing the selected media, but it would probably be quite clunky...

0

There are 0 best solutions below