Can someone give me technique on how to listen for button state (android/iOS) in common code?
s
Sam
12/02/2019, 3:10 AM
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
Joey
12/02/2019, 5:01 AM
Thank you for the helpful info! Will check on how each of them work because im just new in kotlin. Appreciate the help
m
Michal Harakal
12/02/2019, 9:58 AM
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
Joey
12/02/2019, 9:59 AM
Will look into this @Michal Harakal
k
Kris Wong
12/02/2019, 1:30 PM
i have written simple UI in an MPP, so it is possible. but you end up with one implementation per target.