darwinMain.com.arkivanov.essenty.parcelable.CommonParceler.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parcelable Show documentation
Show all versions of parcelable Show documentation
Essential libraries for Kotlin Multiplatform
package com.arkivanov.essenty.parcelable
import com.arkivanov.essenty.utils.internal.ExperimentalEssentyApi
import platform.Foundation.NSCoder
/**
* Interface for [Parceler] implementations in common code (e.g. in `commonMain` source set).
*/
@ExperimentalEssentyApi
actual interface CommonParceler : Parceler {
/**
* Writes the [T] instance state to the provided [writer].
*/
actual fun T.write(writer: ParcelWriter)
/**
* Creates a new instance of [T] and reads all its data from the provided [reader].
*/
actual fun create(reader: ParcelReader): T
override fun create(coder: NSCoder): T =
create(ParcelReader(coder))
override fun T.write(coder: NSCoder) {
write(ParcelWriter(coder))
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy