working for Swift 2.3!

This commit is contained in:
John Rommel Estropia
2016-09-17 12:22:25 +09:00
parent 0dbd05b172
commit aa6bceaaf3
15 changed files with 76 additions and 508 deletions

View File

@@ -205,15 +205,22 @@ internal extension NSManagedObjectContext {
internal func fetchCount(fetchRequest: NSFetchRequest) -> Int? {
var count = 0
var error: NSError?
var countError: ErrorType?
self.performBlockAndWait {
count = self.countForFetchRequest(fetchRequest, error: &error)
do {
count = try self.countForFetchRequest(fetchRequest)
}
catch {
countError = error
}
}
if count == NSNotFound {
CoreStore.log(
CoreStoreError(error),
CoreStoreError(countError),
"Failed executing fetch request."
)
return nil