Вы можете использовать PHAssets и создать свой собственный вид, чтобы пользователи могли выбирать изображения из своих галерей. Возможно пользовательский viewController с collectionView.
Вот пример кода:
func fetchGallaryData(){
// Get the data from gallery
let status = PHPhotoLibrary.authorizationStatus()
if (status == .denied || status == .restricted) {
return
}else{
PHPhotoLibrary.requestAuthorization { (authStatus) in
if authStatus == .authorized{
let imageAsset = PHAsset.fetchAssets(with: .image, options: nil)
for index in 0..<imageAsset.count{
self.imageAssets.append((imageAsset[index]))
}
}
}
func getUIImage(asset: PHAsset) -> UIImage? {
// Use the PHAsset to get the UIImage and display it to the user.
var img: UIImage?
let manager = PHImageManager.default()
let options = PHImageRequestOptions()
options.version = .original
options.isSynchronous = true
manager.requestImageData(for: asset, options: options) { data, _, _, _ in
if let data = data {
img = UIImage(data: data)
}
}
return img
}
Дополнительная информация о PHAsset: - https://developer.apple.com/documentation/photokit/phasset