How to make a data class Parcelable in a Kotlin library in multi-module Android project?

390 Views Asked by At

I am trying to break my android app into smaller gradle modules (for now data and model modules). I want to keep my model module as a Kotlin library because it will only contains data classes. But some of those data classes are Parcelable. To use Parcelable in model module I will have to convert it to an Android library which I am trying to avoid.

One solution that I can think of is to create another class in app module with the exact same structure as the original class in model module and then write a mapper function from one class to another. But it looks like a lot of boilerplate just to make them Parcelable.

Is there a better way to do so?

0

There are 0 best solutions below