NSSortDescriptor sorting using NSDate in Swift
问题 How would I sort a NSFetchRequest with that the date property of the managed object. So that it creates a array with the dates going in order? Here is my code so far... var request : NSFetchRequest = NSFetchRequest(entityName: "History"); request.predicate = NSPredicate(format: "counts = %@", true) request.sortDescriptors = [???] <- What should I put here? var results : [NSManagedObject] = context.executeFetchRequest(request, error: nil) as [NSManagedObject] 回答1: // newest first request