From 9e0493a20d2132faa81baceecc8b3a401f29fd2c Mon Sep 17 00:00:00 2001 From: Oleksandr Bretsko Date: Tue, 17 May 2016 08:43:40 +0400 Subject: [PATCH 1/4] fixed Readme replaced importObjects with importUniqueObjects --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a576af9..0248f07 100644 --- a/README.md +++ b/README.md @@ -733,7 +733,7 @@ or multiple objects at once with the `importUniqueObjects(...)` method: ```swift CoreStore.beginAsynchronous { (transaction) -> Void in let jsonArray: [[String: AnyObject]] = // ... - try! transaction.importObjects( + try! transaction.importUniqueObjects( Into(MyPersonEntity), sourceArray: jsonArray ) From a97001cdbbff891068742f2260256dba0f282aa8 Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Tue, 24 May 2016 00:32:54 +0900 Subject: [PATCH 2/4] fixed scheme --- .../xcshareddata/xcschemes/CoreStore iOS7.xcscheme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore iOS7.xcscheme b/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore iOS7.xcscheme index 07b9206..f69a837 100644 --- a/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore iOS7.xcscheme +++ b/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore iOS7.xcscheme @@ -15,7 +15,7 @@ @@ -79,7 +79,7 @@ From c15afcb381cdb46d3d85c0cd0624df8e598e4a3b Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Tue, 24 May 2016 00:40:13 +0900 Subject: [PATCH 3/4] Allow flushing UnsafeDataTransactions to notify its ListMonitors and ObjectMonitors without saving changes to the DataStack (fixes #71) --- .../UnsafeDataTransaction.swift | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/CoreStore/Saving and Processing/UnsafeDataTransaction.swift b/CoreStore/Saving and Processing/UnsafeDataTransaction.swift index 0ef1b94..008431c 100644 --- a/CoreStore/Saving and Processing/UnsafeDataTransaction.swift +++ b/CoreStore/Saving and Processing/UnsafeDataTransaction.swift @@ -91,6 +91,30 @@ public final class UnsafeDataTransaction: BaseDataTransaction { self.context.undo() } + /** + Immediately flushes all pending changes to the transaction's observers. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data. + + - Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`) + - throws: an error thrown from `closure`, or an error thrown by Core Data (usually validation errors or conflict errors) + */ + public func flush() throws { + + try self.context.save() + } + + /** + Flushes all pending changes to the transaction's observers at the end of the `closure`'s execution. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data. + + - Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`) + - parameter closure: the closure where changes can be made prior to the flush + - throws: an error thrown from `closure`, or an error thrown by Core Data (usually validation errors or conflict errors) + */ + public func flush(@noescape closure: () throws -> Void) throws { + + try closure() + try self.context.save() + } + /** Redo's the last undone change to the transaction. */ @@ -122,7 +146,7 @@ public final class UnsafeDataTransaction: BaseDataTransaction { /** Returns the `NSManagedObjectContext` for this unsafe transaction. Use only for cases where external frameworks need an `NSManagedObjectContext` instance to work with. - Note that it is the developer's responsibility to ensure the following: + - Important: Note that it is the developer's responsibility to ensure the following: - that the `UnsafeDataTransaction` that owns this context should be strongly referenced and prevented from being deallocated during the context's lifetime - that all saves will be done either through the `UnsafeDataTransaction`'s `commit(...)` method, or by calling `save()` manually on the context, its parent, and all other ancestor contexts if there are any. */ From e38093342df15d9da6cca57fda16f615b6cbc666 Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Tue, 24 May 2016 00:42:35 +0900 Subject: [PATCH 4/4] version bump, updated dependendencies --- Carthage/Checkouts/GCDKit | 2 +- CoreStore.podspec | 4 ++-- CoreStore/Info.plist | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Carthage/Checkouts/GCDKit b/Carthage/Checkouts/GCDKit index 822fe55..90d4f31 160000 --- a/Carthage/Checkouts/GCDKit +++ b/Carthage/Checkouts/GCDKit @@ -1 +1 @@ -Subproject commit 822fe55fc49fb39d6f9cf97b2f9c048fc6a74179 +Subproject commit 90d4f31f63a1c98bf7090381c844c62d73a4c8eb diff --git a/CoreStore.podspec b/CoreStore.podspec index 4dc6754..453b0d7 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreStore" - s.version = "1.6.5" + s.version = "1.6.6" s.license = "MIT" s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift" s.homepage = "https://github.com/JohnEstropia/CoreStore" @@ -18,5 +18,5 @@ Pod::Spec.new do |s| s.requires_arc = true s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS' } - s.dependency "GCDKit", "1.2.4" + s.dependency "GCDKit", "1.2.5" end \ No newline at end of file diff --git a/CoreStore/Info.plist b/CoreStore/Info.plist index 336748b..075db1c 100644 --- a/CoreStore/Info.plist +++ b/CoreStore/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.6.5 + 1.6.6 CFBundleSignature ???? CFBundleVersion