28 lines
665 B
Swift
28 lines
665 B
Swift
//
|
|
// 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<Location> {
|
|
let request = Location.fetchRequest()
|
|
|
|
request.sortDescriptors = [
|
|
.init(keyPath: \Location.source, ascending: true),
|
|
.init(keyPath: \Location.createdAt, ascending: true)
|
|
]
|
|
request.resultType = .managedObjectResultType
|
|
|
|
return request
|
|
}
|
|
|
|
}
|