Ryan Simon
12/29/2022, 6:40 PMDuration
and the iOS project isn't able to see any of the kotlin datetime functions/classes.
What's the recommended approach for working with this on the iOS side?hfhbd
12/29/2022, 6:48 PMRyan Simon
12/29/2022, 6:49 PMmkrussel
01/01/2023, 12:55 AMDuration
is an inline value class and the Objective-C interop doesn't suppor them, and they all become just Longs
. I found this hard to use from Swift since the Long
doesn't represent something simple like total milliseconds, but instead encodes information about the duration in the most significant bit. I ended up creating a wrapper around duration for my public API.Ryan Simon
01/01/2023, 4:16 PMmkrussel
01/03/2023, 1:24 PMDuration
and delegates to a Duration
.
For me, we created our class before we looked at Kotlin's Duration
class. When we tried to switch to it, we found that using Duration
from Swift was hard, so instead kept the original class design and changed the implementation.