Hello, I noticed that `kotlin.time.Duration` is in...
# multiplatform
d
Hello, I noticed that
kotlin.time.Duration
is inconsistently passed into swift code.
Copy code
class UsedInSwiftCode {
    
    val durations = listOf(10.minutes) // In swift this is just [Any]
    
   	val duration = 10.minutes // In swift this is Int64 of... half-nanoseconds?
}
But other classes (as far as I can tell) are represented in their fullish form in swift in both cases above. Why is that? Is there some way to make it consistent? Or should I just write my own
Duration
and use that instead? Also I am confused about the representation in swift, it seems to be a number of half nanoseconds in that duration which is strange to me, why would it be like that?
d
Hi, have you figured out anything else to do with this? Or do you think it's safe to assume that the Int64 is half-nanoseconds?
d
I ended up just writing my own
Duration
class that works normally in swift
d
Would you mind sharing?
d
It's actually a wrapper around the original
Duration
, its pretty simple really. Just
fun toNanoseconds() = kotlinDuration.toNanoseconds()
type of stuff for every method. I just wanted the
Duration
class to be treated in Swift in a same way as any other class, no half-nanosecond nonsense.
🙌 1