Does fetchLimit fetch the first or last index of CoreData array?

31 Views Asked by At

I just want to retrieve the last stored CoreData value. I'm using the fetchLimit = 1. But I don't understand if this will retrieve the first or the last index of array (not sure if you call stored CoreData Entities arrays).

Will this code below fetch the first or the last? This matters, because I need to know if ascending should be true or false.

let requestTDD = TDD.fetchRequest() as NSFetchRequest<TDD>
let sort = NSSortDescriptor(key: "timestamp", ascending: false)
requestTDD.sortDescriptors = [sort]
requestTDD.fetchLimit = 1

var tdds = [TDD]()
try? tdds = coredataContext.fetch(requestTDD)

Code doesn't generate any errors and data is fetched, I just need to verify if correct.

0

There are 0 best solutions below