How to deal with UnsafeMutableBufferPointer?

33 Views Asked by At

I would like to know how to deal with UnsafeMutableBufferPointer when It comes to initialize It as an empty array and fill It with chunks of [UInt8] ?

I tried to loop over the chunks and store every bytes by doing:

for (i, byte) in chunk.enumerated() {
   buffer[i] = byte
}

But I’m wondering if there’s a more convenient way to achieve this (maybe less memory consuming) ?

0

There are 0 best solutions below