Please anyone can help me about select multiple image from photo library using swift

hello all

i have to make an app in my app i want select multiple image from photo library many person tell me i can’t using UIImagePickerController
please how can i do that and fix it anyone can explain it to me

thank advance

Here it is in ObjC but you can work out the “translation”

  1. First create your own collection view using UICollectionView.
  2. Load all images in some prep method like so:

`@property (strong, nonatomic) PHFetchResult *allPhotos;

PHFetchOptions *allPhotosOptions = [[PHFetchOptions alloc] init];
allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
    _allPhotos = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:allPhotosOptions];

3. Now display the images in your UICollectionView like so: PHAsset *asset = self.allPhotos[indexPath.item];
cell.selectedTick.hidden = YES;
cell.isSelected = NO;
[self.imageManager requestImageForAsset:asset
targetSize:CGSizeMake(100, 100)
resultHandler:^(UIImage *result, NSDictionary *info) { = result;

return cell;

4. Finally in your didSelectItemAtIndexPath method add each array item to some dictionary you want to hold them or array and process the array.

Apple has an example of using the PHPhotoLibrary here:

1 Like

Thank you very much
have you any way for translate this code to swift or any website translate this code to swift ?

thank you advance