Below is the code that works:
let aProvider: () -> [aParticipant] = {
let results = fetchRequestController.fetchedObjects as! [ParticipantFetchResultsProtocol]
var newArray: Array<aParticipant> = Array()
for result in results {
let obj = result as aParticipant
newArray.append(obj)
}
return newArray
}
With map I tried:
var newArray = results.map({aParticipant($0)})
I get an error: aParticipant cannot be constructed because it has no accessible initializers
Is there a way to accomplish this with map
?