mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-25 10:51:59 +01:00
working for Swift 2.3!
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user