appleMain.dev.icerock.moko.resources.compose.internal.NSDataExt.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resources-compose Show documentation
Show all versions of resources-compose Show documentation
Resources access for Kotlin Multiplatform development (mobile first)
/*
* Copyright 2023 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
package dev.icerock.moko.resources.compose.internal
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.addressOf
import kotlinx.cinterop.usePinned
import platform.Foundation.NSData
import platform.posix.memcpy
@OptIn(ExperimentalForeignApi::class)
internal fun NSData.toByteArray(): ByteArray {
return ByteArray([email protected]()).apply {
usePinned { pinned ->
memcpy(pinned.addressOf(0), [email protected], [email protected])
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy