I want to get list of assets from Photo Library but exclude subtypes or assets from smartfolders such as smartAlbumBursts, smartAlbumLivePhotos, smartAlbumScreenshots
my code is
let options = PHFetchOptions()
options.sortDescriptors = [ NSSortDescriptor(key: "creationDate", ascending: true) ]
options.predicate = predicate
let assets = PHAsset.fetchAssets(with: PHAssetMediaType.image, options: options)
I was trying to make predicate like that:
let predicateType = NSPredicate(format: "mediaSubtypes != %@",
PHAssetMediaSubtype.photoScreenshot as! CVarArg)
but 1. it crashes 2. i can add PHAssetMediaSubtype only for screenshot and livePhoto but not for burst photo.
I know that there is method
if let collection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum,
subtype: .smartAlbumBursts, options: nil).firstObject {
but i am not sure how to use that metdhod or subtype for my purposes
Was trying to use representsBurst but have a crash:
let predicateType = NSPredicate(format: "representsBurst == %@", NSNumber(value: false))
reason: 'Unsupported predicate in fetch options: representsBurst == 0'