Compare commits

...

2 Commits

Author SHA1 Message Date
John Rommel Estropia
2e4c9a7a25 fix From clauses not setting the NSFetchRequest's affectedStores property properly 2016-06-05 17:19:20 +09:00
John Rommel Estropia
0c8731c610 improved flushing behavior 2016-05-28 22:34:14 +09:00
5 changed files with 9 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CoreStore"
s.version = "1.6.8"
s.version = "1.6.10"
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"

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.6.8</string>
<string>1.6.10</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@@ -33,11 +33,10 @@ import CoreData
// http://stackoverflow.com/questions/14396375/nsfetchedresultscontroller-crashes-in-ios-6-if-affectedstores-is-specified
internal final class CoreStoreFetchRequest: NSFetchRequest {
@objc
override var affectedStores: [NSPersistentStore]? {
get { return self.safeAffectedStores }
set { self.safeAffectedStores = newValue }
get { return super.affectedStores }
set { super.affectedStores = newValue }
}
private var safeAffectedStores: [NSPersistentStore]?
}

View File

@@ -48,10 +48,6 @@ internal final class CoreStoreFetchedResultsController<T: NSManagedObject>: NSFe
internal init<T>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) {
CoreStore.assert(
fetchClauses.filter { $0 is OrderBy }.count > 0,
"An \(typeName(NSFetchedResultsController)) requires an OrderBy clause."
)
from?.applyToFetchRequest(fetchRequest, context: context, applyAffectedStores: false)
for clause in fetchClauses {

View File

@@ -97,9 +97,9 @@ public final class UnsafeDataTransaction: BaseDataTransaction {
- 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 {
public func flush() {
try self.context.save()
self.context.processPendingChanges()
}
/**
@@ -109,10 +109,10 @@ public final class UnsafeDataTransaction: BaseDataTransaction {
- 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 {
public func flush(@noescape closure: () throws -> Void) rethrows {
try closure()
try self.context.save()
self.context.processPendingChanges()
}
/**