Since iOS 14 there is a new API for photo selection called PHPhotoPicker. Alongside that, newly feature has been added and it allows users to give permission for only selected photos to be accessed by the iOS app.
Considering that, I want to be able to show only photos which user granted access to when opening instance of PHPhotoPicker inside my app.
Code I have so far:
switch PHPhotoLibrary.authorizationStatus(for: .readWrite) {
case .authorized:
//present PHPhotoPicker with content of entire photo library
var config = PHPickerConfiguration()
config.filter = .images
let vc = PHPickerViewController(configuration: config)
vc.delegate = self
viewController.present(vc, animated: true, completion: nil)
case .limited:
//present PHPhotoPicker with only photos user granted access to
}
As far as i've done my research it is possible to present PHPPicker which lets users choose photos to which they grant access (see code bellow), but not possible to actually show any kind of image picker which shows only photos with granted access.
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: self)
Apple documentation isn't really lengthy which surprises me because it makes no sense to be able to present PHPhotoPicker which allows you to give access to certain photos, but then not have a way to present those photos in an image picker.
EDIT:
WhatsApp app example:
• In settings user can select photos which he is fine for the app to have access to:
•Then when he opens the Whatsapp app and tries to send a photo he gets Photo picker noted with number 2 on the picture below:
If he didn't choose "Selected photos" but instead chose "All photos" then he would have photo picker of an entire library shown on second picture and marked with "1. Access to all photos".
So my question is: How to present image picker with only selected photos(second picture number 2.) instead of image picker with entire photo library(second picture number 1.)