mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-26 10:38:30 +02:00
Added setup and transactions demo
This commit is contained in:
@@ -87,7 +87,7 @@ public final class ManagedObjectController<T: NSManagedObject> {
|
||||
*/
|
||||
public func addObserver<U: ManagedObjectObserver where U.EntityType == T>(observer: U) {
|
||||
|
||||
HardcoreData.assert(GCDQueue.Main.isCurrentExecutionContext(), "Attempted to add a \(typeName(observer)) outside the main queue.")
|
||||
HardcoreData.assert(NSThread.isMainThread(), "Attempted to add an observer of type \(typeName(observer)) outside the main thread.")
|
||||
|
||||
self.removeObserver(observer)
|
||||
|
||||
@@ -155,7 +155,7 @@ public final class ManagedObjectController<T: NSManagedObject> {
|
||||
*/
|
||||
public func removeObserver<U: ManagedObjectObserver where U.EntityType == T>(observer: U) {
|
||||
|
||||
HardcoreData.assert(GCDQueue.Main.isCurrentExecutionContext(), "Attempted to remove a \(typeName(observer)) outside the main queue.")
|
||||
HardcoreData.assert(NSThread.isMainThread(), "Attempted to remove an observer of type \(typeName(observer)) outside the main thread.")
|
||||
|
||||
let nilValue: AnyObject? = nil
|
||||
setAssociatedRetainedObject(nilValue, forKey: &NotificationKey.willChangeObject, inObject: observer)
|
||||
|
||||
Reference in New Issue
Block a user