Can someone give me technique on how to listen for...
# multiplatform
j
Can someone give me technique on how to listen for button state (android/iOS) in common code?
s
Most people here don't share code at that level. At best they share it at the level right below the view using some MVC variant like MVVM or MVP. If you really want to try and wrap the two very different ui toolkits with common code it would be a combination of expect/actual classes. I would suggest just writing the ui layer in platform code and use MPP for sharing logic.
👍 1
j
Thank you for the helpful info! Will check on how each of them work because im just new in kotlin. Appreciate the help
m
With MVP you can have even presenters platform independent, so only view is platform specific
The DroidconKotlin app by touchlabs uses MVVM and they share also quite a lot of code between platforms
j
Will look into this @Michal Harakal
k
i have written simple UI in an MPP, so it is possible. but you end up with one implementation per target.
j
Got it, thanks @Kris Wong
m
A bit late to the party, but we just open sourced this: https://github.com/mirego/trikot.metaviews
It allows reactive bindings between kmp and native apps
Any fields (text, color, etc..) can be bound to a ReactiveStream publisher (a coroutine per example)
j
Thanks @Martin Gagnon appreciate the help!