I'm querying core data to get back my entries like this:
let request = NSFetchRequest(entityName: "TeamPerson")
request.resultType = .DictionaryResultType
request.returnsDistinctResults = true
request.predicate = NSPredicate(format: "team == %@", team)
request.propertiesToFetch = ["person.first", "person.last", "person.sql_ident"]
if let results = team.managedObjectContext?.executeFetchRequest(request, error: nil) as? [[String : AnyObject]] {
So now I have an array of dictionary objects as the results variable. Now I want to pass that through map so that I get back a tuple with a formatted name and an integer. I tried this:
results.map {
(dict: [String : AnyObject]) in
let formatted = Person.formattedNameWithFirst(dict["person.first"], last: dict["person.last"])
(formatted, dict["person.sql_ident"])
}
But the compiler complains that "Cannot invoke 'map' with an argument list of type '(([String : AnyObject]) -> _)'