I am trying to use the countForFetchRequest method on a managed object context in Swift 2.0.
countForFetchRequest
I note that the error handling for executeFetchRequest
executeFetchRequest
You need to do like this:
let error = NSErrorPointer() let fetchResults = coreDataStack.context.countForFetchRequest(fetchRequest, error: error) print("Count \(fetchResults)")
This is the code for Swift 2.0