0

I would like to display all the photos from the phone's album/gallery into a view controller by making use of the UICollectionView.

I simply do not know how to retrieve all the images from the albums and automatically displaying them. UIImagePicker allows the user to choose the image but in my case I would like the app to retrieve the photos - without user intervention - and then display them on a collection view.

Can you please hint me on how to get this done?

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

2

use this code it might help you

let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "localIdentifier = %@", YourAlbumLocalIdentifier)
let resultCollections = PHAssetCollection.fetchAssetCollectionsWithType(.Album, subtype: .AlbumRegular, options: fetchOptions)
Pranav
  • 701
  • 4
  • 18