What are the available NSSortDescriptors for PHFetchOptions?

49 views Asked by At

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!

1

There are 1 answers

0
Offswitch On

You can find the available sort descriptors in the documentation for PhotoKit PHFetchOptions.

Note, there are NO descriptors that allow for sorting by photo/movie file size.