Is the fetchAssetCollections method deprecated in latest version of Photos library?

146 views Asked by At

I created a command line project in XCode

enter image description here

I think this is a valid code in swift

 let all = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary,  

However when I try it now, the autocomplete does not list fetchAssetCollections as an option.

enter image description here

Similar issue in my constructor

enter image description here

Here is the code fragment

import Foundation
import Photos

class PhotoExplorer {

    init() {
        PHPhotoLibrary.shared().register(self)
    }

    func listAssetsInPhoto() -> PHCollection {
        let fetchOptions = PHFetchOptions()
        PHAssetCollection.fetch //  <- To be complete

    }
}

Here is my build settings

enter image description here

I added import PhotosUI but it does not help.

Did I do something wrong? Is there an API change?

1

There are 1 answers

0
Anthony Kong On BEST ANSWER

The only way to fix it is by recreating the project.