This might be a very basic question, and I know th...
# multiplatform
d
This might be a very basic question, and I know there is an
expect/actual
answer to this question, but I cant seem to figure it out. We are using
Klock
to handle dates in our mpp project. How can we expose this type as a
NSDate
for the ios platform?
🇳🇴 2
a
Hello! These classes are not equivalent, so the only option will be to provide a function that takes a
Klock
instance as an input and has an
NSDate
return type. As the function has to have access to the
platform.Foundation.NSDate
, it should be written in the native source set of an Apple target.
d
But what should be the return type of the
expect
function that calls the platform defined functions?
a
I meant something like adding extension function
Klock.toNSDate()
to the native source set, not expect-actual machinery. I’m not sure that it would work, got to think some more on this problem
d
Ah, good idea! Unsure how this would be translated into obj-c tho, does it support extension functions?
Please come back to me if you want me to try out anything!