added utilities for combining Where arrays and OrderBy arrays

This commit is contained in:
John Rommel Estropia committed 2017-06-24 17:42:56 +09:00
1 parent e8eb309d82
commit f72efc80b2
2 files changed
+36

No files matched your search

+14
View File
@@ -172,3 +172,17 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
return (self.sortDescriptors as NSArray).hashValue
}
}
// MARK: - Sequence where Element == OrderBy
public extension Sequence where Iterator.Element == OrderBy {
/**
Combines multiple `OrderBy` predicates together
*/
public func combined() -> OrderBy {
return OrderBy(self.flatMap({ $0.sortDescriptors }))
}
}