Sum of values in a dictionary - Swift
<p>So this is just some similar example code below. I am trying to take the heights of all people and add them together so that I can get an average. I can't seem to figure out how to do this with an array of dictionaries. Also I am using Xcode 3.</p>

<pre><code>let people = [
    [
    "name": "John Doe",
    "sex": "Male",
    "height": "183.0"
    ],
    [
    "name": "Jane Doe",
    "sex": "Female",
    "height": "162.0"
    ],
    [
    "name": "Joe Doe",
    "sex": "Male",
    "height": "179.0"
    ],
    [
    "name": "Jill Doe",
    "sex": "Female",
    "height": "167.0"
    ],
]
</code></pre>

<p>The below code seems to just create new empty arrays.</p>

<pre><code>var zero = 0.0
var peopleHeights = Double(player["height"]!)
var totalHeights = zero += peopleHeights!
</code></pre>

<p>The below code doubles each individual value so not what I am looking for.</p>

<pre><code>var zero = 0.0
var peopleHeights = Double(player["height"]!)
var totalHeights = peopleHeights.map {$0 + $0}
</code></pre>

<p>In the below code I get the response: Value of type Double has no member reduce.</p>

<pre><code>var peopleHeights = Double(player["height"]!)
var totalHeights = peopleHeights.reduce(0.0,combine: +)
</code></pre>

<p>Any help would be appreciated.</p>