curioustechizen
07/21/2025, 11:05 AMkotlinx.datetime.Instant
would be visible to iOS as Kotlinx_datetimeInstant
Since it is moved to the stdlib, what should it be exported as? Kotlin_timeInstant
is not found, neither is just Instant.Dmitry Khalanskiy [JB]
07/21/2025, 11:08 AMInstant
to Native and instead use a native NSDate
object:
• https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/kotlinx.datetime/to-n-s-date.html
• https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/kotlinx.datetime/to-kotlin-instant.htmlcurioustechizen
07/21/2025, 11:11 AMextension Date {
static func instantFromEpochSeconds(date: Date) -> Kotlinx_datetimeInstant {
return Kotlinx_datetimeInstant.Companion()
.fromEpochSeconds(
epochSeconds: Int64(date.timeIntervalSince1970),
nanosecondAdjustment: Int32(0)
)
}
}
I just want to change the return type of this Swift function.curioustechizen
07/22/2025, 6:58 AMKotlinInstant
in place of Kotlinx_datetimeInstant
However like Dmitry mentioned above, this is probably not the best approach. I should change my APIs such that Instant should never have to be used directly from Swift.