How to get image file name in PHPickerViewController, that is, after selecting multiple images from photo library?

I have followed a basic tutorial for importing multiple images using PHPicker

(Link: https://www.youtube.com/watch?v=V-kSSjh1T74&list=PL5Adl54O3opbk_Du94r8OmeSwk2x5dRao&index=15&t=74s).

I also want to get their file names along with their images. I got multiples solutions for doing this with UIImagePickerController but none for PHPickerViewController.

Any leads would be appreciated. Thanks.

Replies

Got the solution:

Inside the 'picker' function func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { } while iterating through the imported images array put guard let imgFileName = photo.itemProvider.suggestedName else { return } for each image, the 'imgFileName' will give the file name in string (without file extension though).