Check out example codes for "swift core data sort by date". It will help you in understanding the concepts better.

Code Example 1

var sdSortDate = NSSortDescriptor.init(key: "date", ascending: false)
fr.sortDescriptors = [sdSortDate]
let result4 = try! context.fetch(fr)

Learn ReactJs, React Native from akashmittal.com