https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

nestserau

11/13/2018, 2:24 PM
According to documentation,
kotlin-stdlib/kotlin.native/toUtf8
should be available on String in my multiplatform project. But I cannot invoke it. Intellisense doesn’t see that method. What am I doing wrong?
Okay, seems I get it. I can use
toUtf8
for
compileKotlinIos
task (native code), but not for JVM. So that’s where the code will have to get platform-specific.
d

drofwarcs

11/13/2018, 7:39 PM
If you are using kotlinx serialization, it has these that you can use
Copy code
expect fun String.toUtf8Bytes(): ByteArray
expect fun stringFromUtf8Bytes(bytes: ByteArray): String
n

nestserau

11/14/2018, 8:32 AM
Thank you Eric