coletz
12/13/2018, 3:18 PMcoletz
12/13/2018, 4:47 PMmyByteArray.toList()
in order to return a List<Byte> to the swift side, then on swift I'm casting every KotlinByte to a Int8 (myKotlinByte as! Int8
) then every Int8 to UInt8 (UInt8(bitPattern: myInt8)
) and finally merged every UInt8 to an array and pushed it to a Data objectnestserau
12/14/2018, 4:02 PMnestserau
12/14/2018, 4:08 PMNSArray<KotlinUByte *> *encodedRecord = [self encode];
NSUInteger byteCount = encodedRecord.count;
unsigned char *buffer = malloc(byteCount);
for (NSUInteger i = 0; i < byteCount; i++)
buffer[i] = [encodedRecord[i] unsignedCharValue];
return [NSData dataWithBytesNoCopy:buffer length:byteCount];
Hope that helps.