Since migrating from 2.2 to 2.3 I now get an the following error:
"Extra Argument in call" in the following code:
class func objectCountForEntity (entityName:String, context:NSManagedObjectContext) -> Int {
let request = NSFetchRequest(entityName: entityName)
var error:NSError?
let count = context.countForFetchRequest(request, error: &error)
if let _error = error {
print("\(#function) Error: \(_error.localizedDescription)")
} else {
print("There are \(count) \(entityName) object(s) in \(context)")
}
return count
}
Could any one advise how I obtain an entity count in swift 2.3 since countForFetchRequest no longer functions in the way it did in swift 2.2