I am trying to match iOS code to Java code, and I run into the problem. I read all the answers and as far as I understood I need to use ByteBuffer as an equivalent to NSData in Swift. But I couldn't find the methods that will help me to achieve this logic.
In Java I need to initializes an object filled with a given number of bytes copied from a given buffer, like in this code
let data = NSData(bytes: array, length: 4)As a second step I need to get a copy a number of bytes from the start of the data object into a given buffer, like in this array.
data.getBytes(&value, length: 4).
Will appreciate any help.