Reputation: 1441
I'm new to the Photos framework and predicates, so bear with me. I found that you can query the photo library based on the creation date of the photo by using something like this:
let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "creationDate > %@ AND creationDate < %@", startDate, endDate)
Is there a way to query based on a range of latitudes and longitudes? For example: get all the pictures in the photo library between (48.512511, -121.047363) and (48.479458, -120.976295)?
Upvotes: 1
Views: 998
Reputation: 2012
Unfortunately the PHFetchOptions
does not support querying for location. The supported keys can be seen in the documentation:
The only possible solution for you is to fetch all photos and then filter the PHAsset
s in memory based on the location
property:
Upvotes: 1