Skip to content

Commit

Permalink
Don't automatically call save
Browse files Browse the repository at this point in the history
  • Loading branch information
acwright committed Nov 12, 2019
1 parent 6b82fc5 commit ddf0ed9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Sources/Cabinet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public extension Cabinet {
func insert<I>(object: I, completion: @escaping (Result<Bool, Error>) -> Void) where I : Storable {
object.insert(context: self.persistentContainer.viewContext)

self.save(completion)
completion(.success(true))
}

func update<I>(objects: [I], completion: @escaping (Result<Bool, Error>) -> Void) where I : Storable {
Expand All @@ -112,8 +112,7 @@ public extension Cabinet {
objects.first { $0.id == id }?.update(object: object)
}
}

self.save(completion)
completion(.success(true))
}
}

Expand Down Expand Up @@ -159,7 +158,7 @@ public extension Cabinet {
NSManagedObjectContext.mergeChanges(fromRemoteContextSave: childChanges, into: [managedObjectContext])
}

self.save(completion)
completion(.success(true))
} catch {
completion(.failure(error))
}
Expand Down

0 comments on commit ddf0ed9

Please sign in to comment.