Anyone have advice for kmm interop with Swift? Specifically how Kotlin
Bool
Int
and
Double
become
KotlinBool
Int32
and
KotlinDouble
Josh Cockrell
07/12/2022, 5:51 PM
It's just annoying how every time I call a Kotlin multiplatform method that returns a
Bool
, I need to put a
.boolValue
on the end of it.
Or worse, if the method returns an object that has a
Bool
property on it, I either need to convert the entire object manually
user = User(isAdmin: kotlinUser.isAdmin.boolValue)
to get rid of that
KotlinBool
type. Or I need to give in and make my entire Swift codebase deal with a user object that has this
KotlinBool
property on it.
n
Nikolay Kasyanov
07/13/2022, 7:09 AM
KotlinBool usually appears when there’s nullability, plain Kotlin Booleans become Swift’s Bool most of the time IIRC
Nikolay Kasyanov
07/13/2022, 7:17 AM
or you’re hitting a bug where they don’t
j
Josh Cockrell
07/13/2022, 2:26 PM
Ah interesting. I'll look into that. What about Int and Double? I would put in a large amount of effort to somehow configure kmm so it knows I explicitly want a Swift Int and Double instead of