title: Xcode Swift - How to initialize a 2D array of [[AnyObject]] of as many elements you want
body: <p>I know I can initialize an array of Ints for example like:</p>
  
  <pre><code>var intArray = [Int](count: 10, repeatedValue: 0)
  </code></pre>
  
  <p>What I want to do is something like this:</p>
  
  <pre><code>var array = Array(count:6, repeatedValue:Array(count:0, repeatedValue:AnyObject()))
  </code></pre>
  
  <p>(Xcode returns with: AnyObject cannot be constructed because it has no accessible initializers)</p>
  
  <p>With the same outcome as I could initialize the array like:</p>
  
  <pre><code>var anyObjectArray : [[AnyObject]] = [[],[],[],[],[],[]]
  </code></pre>
  
  <p>But doing the above is ugly if i need like 100 rows of lets say 3</p>
  
  <p>The problem is I can append in my function like:</p>
  
  <pre><code>// init array
  var anyObjectArray : [[AnyObject]] = [[],[],[]]
  
  //inside a for loop
  anyObjectArray[i].append(someValue)
  </code></pre>
  
  <p>That works ok, until of course i gets higher then the number of rows in the array.
  A answer to this problem is also acceptable if I could do something like:</p>
  
  <pre><code>anyObjectArray[append a empty row here][]
  </code></pre>
  
  <p>But that is probably stupid :)</p>
  
  <p>I hope there is a way to do this cause I don't feel like having a line like:</p>
  
  <pre><code>var anyObjectArray : [[AnyObject]] = [ [],[],[],[],[],[],[],[],[],[],[],[],[],[],[], ... etc ]
  </code></pre>
  
  <p>at the top of my page ;) </p>
  
  <p>Thank you for your time!</p>