diff --git a/Sources/OrderBy.swift b/Sources/OrderBy.swift index 126f4ae..9e4dd5c 100644 --- a/Sources/OrderBy.swift +++ b/Sources/OrderBy.swift @@ -185,6 +185,14 @@ public struct OrderBy: OrderByClause, FetchClause, QueryClause // MARK: CoreStoreObject Key Paths + + /** + Indicates that the `KeyPathString` should be sorted in ascending order + */ + public static func ascending(_ attribute: KeyPath.Stored>) -> SortKey { + + return .ascending(O.meta[keyPath: attribute].keyPath) + } /** Indicates that the `KeyPathString` should be sorted in ascending order @@ -217,6 +225,14 @@ public struct OrderBy: OrderByClause, FetchClause, QueryClause return .ascending(O.meta[keyPath: attribute].keyPath) } + + /** + Indicates that the `KeyPathString` should be sorted in descending order + */ + public static func descending(_ attribute: KeyPath.Stored>) -> SortKey { + + return .descending(O.meta[keyPath: attribute].keyPath) + } /** Indicates that the `KeyPathString` should be sorted in descending order