is it possible to convert a Kotlin `ByteArray` to ...
# kotlin-native
d
is it possible to convert a Kotlin
ByteArray
to Swift
Data
without copying every byte?
j
I am using this method for base64 encoding. It does conversion to NSData without copy.
Copy code
actual fun encode(bytes: ByteArray) = memScoped {
    NSData.create(
        bytesNoCopy = bytes.toCValues().getPointer(this),
        length = bytes.size.toULong()
    ).base64EncodedStringWithOptions(0)
}
🙏 1
d
nice
i was trying to handle the
KotlinByteArray
from swift. this looks much better
is there an
actual fun
on the Android side too or you're just doing swift?
957 Views