Francis Mariano
06/26/2021, 2:27 PMexpect fun String.formatPlatform(vararg args: Any?): String
and on iosMain module I wrote the actual function
actual fun String.formatPlatform(vararg args: Any?): String {
return NSString.create(format = this, args = arrayOf(args)).toString()
}
But when I compile that code I get this error : kotlin.Array<out kotlin.Any?> is not supported here: doesn't correspond to any C type
I tried to change the parameter type from expect function to Float or Double, but the error continues: kotlin.Array<out kotlin.Float?> is not supported here: doesn't correspond to any C type
I read the issue https://github.com/JetBrains/kotlin-native/issues/1834 but I do not solve the problem. Can anyone help me with that? Thank you.louiscad
06/27/2021, 6:52 AM*
).
Look at this comment in the issue: https://github.com/JetBrains/kotlin-native/issues/1834#issuecomment-484854268Francis Mariano
06/28/2021, 11:34 AMRedundant spread (*) operator
and the error is the same.
actual fun String.formatPlatform(vararg args: Any?): String {
return NSString.create(format = this, args = *arrayOf(args)).toString()
}
louiscad
06/28/2021, 11:57 AMstringWithFormat
?Francis Mariano
06/28/2021, 12:41 PMactual fun String.formatPlatform(vararg args: Any?): String {
return NSString.stringWithFormat(format = this, args = arrayOf(args))
}
type kotlin.Array<out kotlin.Any?> is not supported here: doesn't correspond to any C type
louiscad
06/28/2021, 2:35 PMFrancis Mariano
06/28/2021, 2:59 PM