Anyone have advice for kmm interop with Swift? Spe...
# ios
j
Anyone have advice for kmm interop with Swift? Specifically how Kotlin
Bool
Int
and
Double
become
KotlinBool
Int32
and
KotlinDouble
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
KotlinBool usually appears when there’s nullability, plain Kotlin Booleans become Swift’s Bool most of the time IIRC
or you’re hitting a bug where they don’t
j
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
Int32
and
KotlinDouble
n
I wonder from what Kotlin code you get
KotlinBoolean
and
KotlinDouble
(can’t help with
Int32
though – no solution that I know of)
106 Views