ios - Swift 3.0 convert Data to Array<UInt8> -
how convert data array of uint8?
func serialport(_ serialport: orsserialport, didreceive data: data) { print("recieved:\(data)") let arr: [uint8] = data(???)??? } log recieved:70 bytes
in swift 3, data works collection of uint8, can use array.init.
var recived: [uint8] = [] func serialport(_ serialport: orsserialport, didreceive data: data) { print("recieved:\(data))") recived = array(data) } but, array.init (or array.append(contentsof:)) copies content of data, it's not efficient when need work huge size of data.
Comments
Post a Comment