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