Stage 2 changes - Xantier/multiplat-workshop GitHub Wiki
- Model.kt
- Adding serializable annotations to model data classes
- Adding a serializer implementation for photo list
@Serializable
val photoListSerializer: KSerializer<List<Photo>> = Photo::class.serializer().list
- gradle.build
- Applying
kotlinx-serialization
plugin to the build - Adding needed dependency for multiplatform serialization
- Applying
apply plugin: 'kotlinx-serialization'
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
- build.gradle
- Adding needed serialization runtime
apply plugin: 'kotlinx-serialization'
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
Adding serialization of returned JSON to list of our Photo objects
- ApiClient.kt
val photoList = JSON.nonstrict.parse(photoListSerializer, returnable)
- build.gradle
- Adding needed serialization runtime
apply plugin: 'kotlinx-serialization'
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version"
- ApiClient.kt
- Adding serialization of returned JSON to list of our Photo objects
val photoList = JSON.nonstrict.parse(photoListSerializer, returnable)
- index.html
- Add serialization.js script to the HTML