答案 0 :(得分:0)
是的,您可以按列排序。
class func fetchFromCoreData() -> [ReturnType] {
let context:NSManagedObjectContext = MyCoreDataManager.sharedInstance.managedObjectContext
let request:NSFetchRequest<EntityName> = self.fetchRequest()
request.sortDescriptors = [NSSortDescriptor(key: "attributeName", ascending: false)]
let myCoreDataArray = try? context.fetch(request)
return myCoreDataArray ?? []
}