title: Swift 2D Array Initialisation with Objects
body: <p>I'm Trying to initialise a 2D array with objects in every cell.
  I started with a class,</p>
  
  <pre><code>class cell {
      var up = 1
      var down = 1
      var right = 1
      var left = 1
  }
  </code></pre>
  
  <p>And then Initialise my Array as such:</p>
  
  <pre><code>let row = Array&lt;cell!&gt;(count: 10, repeatedValue: cell())
  let myArray = Array(count: 10, repeatedValue: row)
  </code></pre>
  
  <p>Now that works fine... Until I change the property of one of the objects.</p>
  
  <pre><code>myArray[0][0].left = 0
  </code></pre>
  
  <p>Then ALL objects in the Array have their "left" property set to 0.</p>
  
  <p>How can I create objects that are independent of each other in the Array? (without using for-loops to append each item individually)</p>