Benoye
12/15/2021, 1:56 PMiosMain
:
fun NSData.toByteArray(): ByteArray = ByteArray(this@toByteArray.length.toInt()).apply {
usePinned {
memcpy(it.addressOf(0), this@toByteArray.bytes, this@toByteArray.length)
}
}
This one allows to convert a NSData
in Objective-C to a ByteArray
in Kotlin
Is it possible to use this function directly in XCode on a NSData
object ?mkrussel
12/15/2021, 2:04 PMrusshwolf
12/15/2021, 3:57 PMBenoye
12/15/2021, 4:23 PM