Skip to content

Commit 71a15a0

Browse files
committed
NSSortDescriptor
1 parent 7992489 commit 71a15a0

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

Sources/CoreDataQueryInterface/QueryBuilder+Order.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ public extension QueryBuilder {
2828
}
2929

3030
func order<V: Expression>(_ direction: SortDirection = .ascending, by keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
31-
let sortDescriptor = NSSortDescriptor(objectKeyPath: keyPath, ascending: direction.isAscending)
32-
var query = self
33-
query.sortDescriptors.append(sortDescriptor)
34-
return query
31+
order(by: .init(objectKeyPath: keyPath, ascending: direction.isAscending))
3532
}
3633

3734
func order<V1: Expression, V2: Expression>(

Sources/CoreDataQueryInterface/QueryBuilder+Order.swift.gyb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ public extension QueryBuilder {
3333
}
3434

3535
func order<V: Expression>(_ direction: SortDirection = .ascending, by keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
36-
let sortDescriptor = NSSortDescriptor(objectKeyPath: keyPath, ascending: direction.isAscending)
37-
var query = self
38-
query.sortDescriptors.append(sortDescriptor)
39-
return query
36+
order(by: .init(objectKeyPath: keyPath, ascending: direction.isAscending))
4037
}
4138
% for i in range(2, 8):
4239

0 commit comments

Comments
 (0)