Map modify array of objects in Swift 2.2 (3.0)
<p>I want to be able to modify my array of objects using <code>map</code> in Swift of the fly, without looping through each element.</p>

<p>Before here were able to do something like this (Described in more details <a href="http://kelan.io/2016/mutating-arrays-of-structs-in-swift/" rel="noreferrer">here</a>:</p>

<pre><code>gnomes = gnomes.map { (var gnome: Gnome) -&gt; Gnome in
    gnome.age = 140
    return gnome
}
</code></pre>

<p>Thanks for Erica Sadun and others, new proposals have gone through and we're now getting rid of C-style loops and using <code>var</code> inside the loop.</p>

<p>In my case I'm first getting a warning to remove the <code>var</code> in then an error my <code>gnome</code> is a constant (naturally)</p>

<p>My question is : How do we alter arrays inside a <code>map</code> or the new styled loops for that matter to be fully prepared for Swift 3.0?</p>