Sum values of properties inside array of custom objects using reduce
The same way as with plain numbers:
let foos: [Foo] = ...
let sum = foos.lazy.map { $0.value }.reduce(0, +)
It simply like this
let sum = array.reduce(0) { $0 + $1.value }