I have a domain module (contains model and use-cas...
# kotlin-native
r
I have a domain module (contains model and use-cases) and ui-module, ui-module is dependent on domain module. I need to parcelize one of the model of domain-module, but to use it, i need to convert it to android library to take leverage of
@Parcelize
Any way, can i make use of
typealias
and
expect
and
actual
without converting the domain pure kotlin module to android module?
r
You can do an `expect`/`actual` annotation definition. Plus for annotations you can leverage
@OptionalExpectation
so you only need an
actual
declaration on Android
r
okay, have you tried in android in multi-module project, where one one module is kotlin library and other one android library. And
expect
in kotlin lib and
actual
in android.
a
I wrote up my experiences doing the same thing: https://ankushg.com/posts/multiplatform-parcelize/
r
@ritesh no, expect and actual declarations need to live in the same gradle module. Ankush's writeup looks like a good description of what I'm suggesting
r
Sure. @ankushg Great article! Thanks for sharing. @russhwolf yeah, i dont think it will work in my case as when i try to use
expect
in domain-module which is pure kotlin, it asks me to turn on the androidExtension experimental feature and to do that i need an android block and for that convert the gradle from kotlinLibrary to androidLibrary. Why not i directly use
@Parceclize
if i change gradle to android lib.
r
Applying the android plugin to your domain module doesn't stop it from being a kotlin module. I don't understand what your limitation is
r
yeah, I ended up converting kotlinLibrary to androidLibrary and the extention plugin and using directly the
@Parcelize
If this is what you meant @russhwolf ?