Add -observable to CoreData storages

This commit is contained in:
Pedro Piñera Buendía 2016-05-06 15:38:48 +02:00
parent ba1de75714
commit 9a40d5394c
2 changed files with 15 additions and 1 deletions

View File

@ -87,6 +87,13 @@ public class CoreDataDefaultStorage: Storage {
self.mainContext = cdContext(withParent: .Context(self.rootSavingContext), concurrencyType: .MainQueueConcurrencyType, inMemory: false)
}
// MARK: - Public
public func observable<T: NSManagedObject>(request: Request<T>) -> Observable<T> {
return CoreDataObservable(request: request, context: self.mainContext as! NSManagedObjectContext)
}
}

View File

@ -78,7 +78,7 @@ public class CoreDataiCloudStorage: Storage {
}
// MARK: - Constructors
// MARK: - Init
public init(model: CoreData.ObjectModel, iCloud: ICloudConfig) throws {
self.objectModel = model.model()!
@ -90,6 +90,13 @@ public class CoreDataiCloudStorage: Storage {
}
// MARK: - Public
public func observable<T: NSManagedObject>(request: Request<T>) -> Observable<T> {
return CoreDataObservable(request: request, context: self.mainContext as! NSManagedObjectContext)
}
// MARK: - Private
private func observeiCloudChangesInCoordinator() {