mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-20 16:44:08 +01:00
WIP: query chains!
This commit is contained in:
@@ -35,7 +35,7 @@ import CoreData
|
||||
- SeeAlso: `Where`
|
||||
*/
|
||||
@objc
|
||||
public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause, CoreStoreObjectiveCType {
|
||||
public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause {
|
||||
|
||||
/**
|
||||
The internal `NSPredicate` instance for the `Where` clause
|
||||
@@ -149,11 +149,11 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
|
||||
// MARK: CoreStoreObjectiveCType
|
||||
|
||||
public let bridgeToSwift: Where
|
||||
public let bridgeToSwift: Where<NSManagedObject>
|
||||
|
||||
public init(_ swiftValue: Where) {
|
||||
public init<D: NSManagedObject>(_ swiftValue: Where<D>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
|
||||
// MARK: - Where
|
||||
|
||||
extension Where: CoreStoreSwiftType {
|
||||
extension Where where D: NSManagedObject {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
@@ -169,4 +169,12 @@ extension Where: CoreStoreSwiftType {
|
||||
|
||||
return CSWhere(self)
|
||||
}
|
||||
|
||||
|
||||
// MARK: FilePrivate
|
||||
|
||||
fileprivate func downcast() -> Where<NSManagedObject> {
|
||||
|
||||
return Where<NSManagedObject>(self.predicate)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user