mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-23 01:49:53 +01:00
complete query utilities
This commit is contained in:
@@ -35,7 +35,7 @@ import CoreData
|
||||
- SeeAlso: `GroupBy`
|
||||
*/
|
||||
@objc
|
||||
public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
|
||||
public final class CSGroupBy: NSObject, CSQueryClause {
|
||||
|
||||
/**
|
||||
The list of key path strings to group results with
|
||||
@@ -102,11 +102,11 @@ public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
|
||||
|
||||
// MARK: CoreStoreObjectiveCType
|
||||
|
||||
public let bridgeToSwift: GroupBy
|
||||
public let bridgeToSwift: GroupBy<NSManagedObject>
|
||||
|
||||
public init(_ swiftValue: GroupBy) {
|
||||
public init<D: NSManagedObject>(_ swiftValue: GroupBy<D>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
|
||||
|
||||
// MARK: - GroupBy
|
||||
|
||||
extension GroupBy: CoreStoreSwiftType {
|
||||
extension GroupBy where D: NSManagedObject {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
@@ -122,4 +122,12 @@ extension GroupBy: CoreStoreSwiftType {
|
||||
|
||||
return CSGroupBy(self)
|
||||
}
|
||||
|
||||
|
||||
// MARK: FilePrivate
|
||||
|
||||
fileprivate func downcast() -> GroupBy<NSManagedObject> {
|
||||
|
||||
return GroupBy<NSManagedObject>(self.keyPaths)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user