I am having trouble determining the syntax for reducing an array of a custom managed object subclass in Swift. I have a managed object subclass with a property called amount which is a NSNumber. How do I use the reduce function to get the sum of amount for each item in the array of managed objects. Here is what I have tried, but I get an error stating "could not find member 'amount'".
let reduceSum=myArray.reduce(0) {$0 + $1.amount}
I have looked at this example, but it didn't help since I'm getting the could not find member error.