https://kotlinlang.org logo
Title
a

Aditya Kurkure

07/01/2022, 8:11 AM
How can I access the swift
JsonEncoder
and
JsonDecoder
in Kotlin native? I noticed a JsonDecoder in Mapkit but can't see the Encoder in the same package.
r

ribesg

07/01/2022, 9:42 AM
If these are pure Swift APIs, you can’t use them in Kotlin. You can only use Objective-C APIs in Kotlin.
Looks like pure Swift (can’t select Objective-C as language in the top right corner) https://developer.apple.com/documentation/foundation/jsonencoder
If you want to do Json in Kotlin/Native you should use kotlinx.serialization
a

Aditya Kurkure

07/01/2022, 2:55 PM
Thanks @ribesg