nachshon fertel
nachshon fertel

Reputation: 80

How to organize icloud data by date added?

I am making an app that uses cloud-kit, and when I ask it to return the data saved on it, its out of order. How to i organize the data by date? And then save it in an array, with array [0] as the most recent data added? by the way, the view controller that saves the data is a different view controller that loads it.

Upvotes: 1

Views: 87

Answers (1)

Edwin Vermeer
Edwin Vermeer

Reputation: 13127

You could ad a sort order to your query like this:

query.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]

Upvotes: 1

Related Questions