Averaging a collection of values in Swift Nov 25, 2020 let averageMinutesAsleep = itemsToConsider.reduce(0) { $0 + $1.minutesAsleep} / itemsToConsider.count