Jeremias Nunez
05/04/2021, 2:55 PMmkrussel
05/04/2021, 3:04 PMJeremias Nunez
05/04/2021, 3:06 PMpublic fun ByteArray.toData(): NSData = memScoped {
NSData.create(bytes = allocArrayOf(this@toData),
length = this@toData.size.toULong())
}
Jeremias Nunez
05/04/2021, 3:06 PMmkrussel
05/04/2021, 3:08 PMJeremias Nunez
05/04/2021, 3:17 PMJeremias Nunez
05/04/2021, 4:54 PM*var* bytes = [UInt8]()
*let* it = byteArray.iterator()
*while* (it.hasNext()) {
bytes.append(UInt8(it.nextByte()))
}
Getting an exception saying that hasNext
is abstract? However if I print the type of the iterator in the Xcode console I see kotlin.ByteIteratorImpl
Jeremias Nunez
05/04/2021, 7:53 PM