https://kotlinlang.org logo
#android
Title
# android
s

Saiedmomen

01/08/2019, 4:34 PM
Is it possible to share models with a backend module with room? I have a common module with all my models and I want to use those models to save data to sqlite in my app module
I'm pretty sure it's impossible. Just wanted to make sure there isn't a piece of kotlin magic that I've missed
d

Dominaezzz

01/08/2019, 5:42 PM
It shouldn't be impossible. You'll just have to figure out how to handle annotations I think.
s

Saiedmomen

01/08/2019, 6:38 PM
Yes. Annotations are why it is impossible. That and the fact that data classes are strictly final
d

Dominaezzz

01/08/2019, 6:39 PM
You could typealias the annotations on the other platforms.
s

Saiedmomen

01/09/2019, 8:19 AM
yeah it could work actually. There is also an artifact "room-common" with all the annotations and almost nothing else. I haven't been able to test it completely yet but things look good. Thank you :)
2 Views