How to display current selected photos when presenting a PHPickerViewController manually?

1.3k views Asked by At

Is there a way to show the user's current photo selections when presenting a PHPickerViewController manually? For example, when using the following code the picker doesn't show any of the user's currently selected photos.

 var pickerConfig = PHPickerConfiguration()
 pickerConfig.selectionLimit = 0
 pickerConfig.filter = .any(of: [.images])
            
 let imagePicker = PHPickerViewController(configuration: pickerConfig)
 imagePicker.delegate = self

 // When presented, the user's current selected photos are empty, nothing is selected
 viewController.present(imagePicker, animated: true)

However, if I use Apple's built in presentLimitedLibraryPicker function it does show the user's current photo selections:

// This does show the user's current selections
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from controller: self)

Is there a way to get this behavior without using presentLimitedLibraryPicker?

0

There are 0 answers