toByteArray

private fun NSData.toByteArray(): ByteArray(source)

Converts native NSData to a Kotlin ByteArray.

Uses memScoped and memcpy for high-performance memory copying from the Objective-C pointer to the Kotlin managed array.