Hello all, did anyone use Protobuf for KMM project...
# multiplatform
m
Hello all, did anyone use Protobuf for KMM project? Basically, my generated Protobuf files are in
build
folder, I generated both Kotlin and mandatory Java file. The problem is: I see generated files in
androidMain
but I cannot see generated Kotlin models in
commonMain
(which makes sense since they rely on Java file), and when I add files to sourceSets, Kotlin Proto files gets corrupted and are unable to resolve mandatory proto Java file. Did anyone encounter this and how did you solve it?
you should use wire
m
hm, yeah. I will give it a shot. Thanks! 🙂
d
I'm using https://github.com/streem/pbandk for protobuf in a KMM app.
v
Personally, I’d recommend Wire, at least for the interoperability between Android and iOS in our project that was the best solution. My reasoning is in this thread: https://kotlinlang.slack.com/archives/C3PQML5NU/p1663019385615999
m
What I basically want to achieve is: have Proto models in data layer which will be mapped to domain models (pure data classes) and exposed to iOS in form of use cases. So on iOS side developers wouldn’t even need to use Protobuf. I have to research this in more details. Thanks for the advice!
373 Views