https://kotlinlang.org logo
#compose
Title
# compose
l

Loboda Deni

07/15/2020, 8:56 AM
Hi. Is it possible to use this technology together with mvvm architecture?
t

Timo Drick

07/15/2020, 8:59 AM
It is independent of any architecture. In my opinion MVVM architecture maybe makes more sense in Compose. Because in Android legacy system you have already the Android view/controller (View -> View |Activity,Fragment -> Controller) architecture putting MVVM on this just doubles you boilerplate code. So yes Compose will work with most architectures i think.
l

Loboda Deni

07/15/2020, 9:05 AM
can you recommend some kind of example? I'm wondering how to implement something similar to two-way binding
t

Timo Drick

07/15/2020, 9:11 AM
In Compose you define composables (functions) which gets the data as parameters and define callbacks to get back user interactions. You could also define the datamodel in a special way (MutabelState<T>) and access this from different parts of your app. It will be synchronized.
Btw. you can define also the composable functions inside of a class and access functions of this class. The approach is completely differnt from the legacy view system. So take you time to understand it but there are no limits. But all thinks must be implemented a little bit different to the legacy view system.
l

Loboda Deni

07/15/2020, 9:17 AM
is working with a camera supported? is there something like TextureView?
t

Timo Drick

07/15/2020, 9:18 AM
No
But there is a SurfaceView
l

Loboda Deni

07/15/2020, 9:19 AM
and it's also very interesting, are ui tests different when using this technology?
t

Timo Drick

07/15/2020, 9:20 AM
Yes i think also completely different. And keep in mind every thing is under heavy development.
Here the sample with Opengl inside of Compose: https://github.com/romainguy/sample-materials-shop
l

Loboda Deni

07/15/2020, 9:22 AM
understood thanks