title: Swift: Create Array of UInt8 with defined number of Values
body: <p>How is it possible to create an <code>Array</code> of <code>UInt8</code> in Swift?
  I've tried this with the following code:</p>
  
  <pre><code>var array: [UInt8] = [UInt8]()
  </code></pre>
  
  <p>Now I want to loop through a second <code>UInt</code> variable <code>a</code> : </p>
  
  <pre><code>for var i: Int = 0; i &lt; a.count; i++ {
      array[i] = UInt8(a[i]^b[i])
  }
  </code></pre>
  
  <p>But then I get the following error :</p>
  
  <blockquote>
    <p>fatal error: Array index out of range</p>
  </blockquote>
  
  <p>When I put the same bits as <code>a</code> -> <code>[0x01,0x01,0x01,0x01,0x01]</code> in the variable <code>array</code> then the loop works fine!</p>
  
  <p>Does anybody know why?</p>