diff --git a/CoreStore.podspec b/CoreStore.podspec index e01a6fd..55a119c 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreStore" - s.version = "4.0.5" + s.version = "4.1.0" 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" diff --git a/Sources/CoreStore+Transaction.swift b/Sources/CoreStore+Transaction.swift index de8386a..60e36e8 100644 --- a/Sources/CoreStore+Transaction.swift +++ b/Sources/CoreStore+Transaction.swift @@ -54,7 +54,7 @@ public extension CoreStore { } /** - Using the `defaultStack`, performs a transaction synchronously where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. The changes are commited automatically after the `task` closure returns. On success, the value returned from closure will be the return value of `perform(synchronous:)`. Any errors thrown from inside the `task` will be rethrown from `perform(synchronous:)`. To cancel/rollback changes, call `try transaction.cancel()`, which throws a `CoreStoreError.userCancelled`. + Using the `defaultStack`, performs a transaction synchronously where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. The changes are commited automatically after the `task` closure returns. On success, the value returned from closure will be the return value of `perform(synchronous:)`. Any errors thrown from inside the `task` will be thrown from `perform(synchronous:)`. To cancel/rollback changes, call `try transaction.cancel()`, which throws a `CoreStoreError.userCancelled`. - parameter task: the synchronous non-escaping closure where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`. - parameter waitForAllObservers: When `true`, this method waits for all observers to be notified of the changes before returning. This results in more predictable data update order, but may risk triggering deadlocks. When `false`, this method does not wait for observers to be notified of the changes before returning. This results in lower risk for deadlocks, but the updated data may not have been propagated to the `DataStack` after returning. Defaults to `true`. diff --git a/Sources/DataStack+Transaction.swift b/Sources/DataStack+Transaction.swift index fc8bef7..dc35caa 100644 --- a/Sources/DataStack+Transaction.swift +++ b/Sources/DataStack+Transaction.swift @@ -95,7 +95,7 @@ public extension DataStack { } /** - Performs a transaction synchronously where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. The changes are commited automatically after the `task` closure returns. On success, the value returned from closure will be the return value of `perform(synchronous:)`. Any errors thrown from inside the `task` will be rethrown from `perform(synchronous:)`. To cancel/rollback changes, call `try transaction.cancel()`, which throws a `CoreStoreError.userCancelled`. + Performs a transaction synchronously where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. The changes are commited automatically after the `task` closure returns. On success, the value returned from closure will be the return value of `perform(synchronous:)`. Any errors thrown from inside the `task` will be thrown from `perform(synchronous:)`. To cancel/rollback changes, call `try transaction.cancel()`, which throws a `CoreStoreError.userCancelled`. - parameter task: the synchronous non-escaping closure where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`. - parameter waitForAllObservers: When `true`, this method waits for all observers to be notified of the changes before returning. This results in more predictable data update order, but may risk triggering deadlocks. When `false`, this method does not wait for observers to be notified of the changes before returning. This results in lower risk for deadlocks, but the updated data may not have been propagated to the `DataStack` after returning. Defaults to `true`. diff --git a/Sources/Info.plist b/Sources/Info.plist index 5d7e8c4..5284837 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.0.5 + 4.1.0 CFBundleSignature ???? CFBundleVersion diff --git a/Sources/NSManagedObjectContext+Querying.swift b/Sources/NSManagedObjectContext+Querying.swift index f857a1a..bb3bd61 100644 --- a/Sources/NSManagedObjectContext+Querying.swift +++ b/Sources/NSManagedObjectContext+Querying.swift @@ -62,9 +62,7 @@ extension NSManagedObjectContext: FetchableSource, QueryableSource { return object } - - let objectDynamicType = type(of: object) - return objectDynamicType.cs_fromRaw(object: existingRawObject) + return type(of: object).cs_fromRaw(object: existingRawObject) } catch { diff --git a/Sources/Where.swift b/Sources/Where.swift index 49fbf36..f7e88ca 100644 --- a/Sources/Where.swift +++ b/Sources/Where.swift @@ -50,13 +50,11 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable { */ public static func && (left: Where, right: Where?) -> Where { - if right != nil { - return left && right! - } - else { + if let right = right { - return left + return left && right } + return left } /** @@ -67,13 +65,11 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable { */ public static func && (left: Where?, right: Where) -> Where { - if left != nil { + if let left = left { + return left && right } - else { - - return right - } + return right } /** @@ -92,13 +88,11 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable { */ public static func || (left: Where, right: Where?) -> Where { - if right != nil { - return left || right! - } - else { + if let right = right { - return left + return left || right } + return left } /** @@ -109,13 +103,11 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable { */ public static func || (left: Where?, right: Where) -> Where { - if left != nil { + if let left = left { + return left || right } - else { - - return right - } + return right } /**