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

Paul Woitaschek

05/17/2021, 1:03 PM
How do you handle inline classes? On 1.4.x we've exposed the kotlin duration to ios. But now with the changes of the internal representation from millis to long the exposed value isn't usable any longer. I thought about `actual typealias`ing it for ios to a regular class and keep duration for android but that won't work either because you'd need to chose between an interface and a class.
l

louiscad

05/17/2021, 1:32 PM
How is it no longer usable?
p

Paul Woitaschek

05/17/2021, 1:45 PM
Well in objective c, inline classes just get exported as the value they wrap
l

louiscad

05/17/2021, 1:45 PM
Just like in Java
p

Paul Woitaschek

05/17/2021, 1:45 PM
l

louiscad

05/17/2021, 1:46 PM
Is it actually always in nanoseconds?
p

Paul Woitaschek

05/17/2021, 1:46 PM
Yes it is
But now with 1.5 it was changed to long
So now having kotlin duration in your public api is unusable from obj-c
l

louiscad

05/17/2021, 1:51 PM
Well, you can add overloads for Obj-C, or if the type is not an interface, extensions will also work and be seen like members in Swift/Obj-C.
(If it's an interface, you might want to make it a stateless abstract class instead)
👍 1