mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-16 22:16:53 +01:00
added demo for observing changes to a single managed object
This commit is contained in:
@@ -61,11 +61,11 @@ public /*abstract*/ class BaseDataTransaction {
|
||||
:param: object the NSManagedObject type to be edited
|
||||
:returns: an editable proxy for the specified NSManagedObject.
|
||||
*/
|
||||
public func fetch<T: NSManagedObject>(object: T) -> T? {
|
||||
public func fetch<T: NSManagedObject>(object: T?) -> T? {
|
||||
|
||||
HardcoreData.assert(self.transactionQueue.isCurrentExecutionContext(), "Attempted to update an entity of type \(typeName(object)) outside its designated queue.")
|
||||
|
||||
return object.inContext(self.context)
|
||||
return object?.inContext(self.context)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,11 +73,11 @@ public /*abstract*/ class BaseDataTransaction {
|
||||
|
||||
:param: object the NSManagedObject type to be deleted
|
||||
*/
|
||||
public func delete(object: NSManagedObject) {
|
||||
public func delete(object: NSManagedObject?) {
|
||||
|
||||
HardcoreData.assert(self.transactionQueue.isCurrentExecutionContext(), "Attempted to delete an entity of type \(typeName(object)) outside its designated queue.")
|
||||
|
||||
object.inContext(self.context)?.deleteFromContext()
|
||||
object?.inContext(self.context)?.deleteFromContext()
|
||||
}
|
||||
|
||||
// MARK: Saving changes
|
||||
|
||||
Reference in New Issue
Block a user