I'm working with Apple's sample code for PhotoBrowse.
In the main view controller's viewDidLoad() method we have this code:
let allPhotosOptions = PHFetchOptions()
allPhotosOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)]
This code sorts the photos by "creationDate". How do I determine/find the other valid values for these sort descriptors? For example, what if I wanted to sort photos by their file size, last modified date, etc.?
TIA!
The supported keys are listed in Table 1 on this page: https://developer.apple.com/documentation/photokit/phfetchoptions
There is no file size key, but modificationDate is supported
Copying here for posterity, the current supported keys for predicates or sort descriptors for PHAsset are
SELF, localIdentifier, creationDate, modificationDate, mediaType, mediaSubtypes, duration, pixelWidth, pixelHeight, isFavorite (or isFavorite), isHidden (or isHidden), burstIdentifier