diff --git a/Apps/Locations/Libraries/Sources/Persistence/Extensions/NSFetchRequest+Location.swift b/Apps/Locations/Libraries/Sources/Persistence/Extensions/NSFetchRequest+Location.swift new file mode 100644 index 0000000..acca57e --- /dev/null +++ b/Apps/Locations/Libraries/Sources/Persistence/Extensions/NSFetchRequest+Location.swift @@ -0,0 +1,27 @@ +// +// NSFetchRequest+Location.swift +// Persistence +// +// Created by Javier Cicchelli on 12/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// + +import CoreData + +public extension NSFetchRequest where ResultType == Location { + + // MARK: Functions + + static func allLocations() -> NSFetchRequest { + let request = Location.fetchRequest() + + request.sortDescriptors = [ + .init(keyPath: \Location.source, ascending: true), + .init(keyPath: \Location.createdAt, ascending: true) + ] + request.resultType = .managedObjectResultType + + return request + } + +}