I made a Server Driven UI example with <Ktor-KMP(I...
# multiplatform
I made a Server Driven UI example with Ktor-KMP(IOS-Android-Desktop). I found equivalents of jetpack libraries for mobile, but as far as I can see, the resources are insufficient for web and desktop. Are there any resources you would recommend on this subject?
d
Please tell what libraries do you use for Android and IOS for Server Driven UI?
I used kamel-moko-serialization-ktor. I also created my own solutions. I'm not sure about their accuracy and effectiveness at the moment. I'm thinking of sharing them after trying them in a more complex, end-to-end application.
p
I have been trying to build a project based on Server Driven UI too. I worked for a company some time ago where it was the core of their business. The same source code was able to build different App layouts for almost a hundred customers. I haven’t seen many resources on the web and desktop since this is more of a mobile thing. Even for mobile there is not much public documentation, most companies doing server driven ui keep their protocols closed. By protocol I mean the data you send from the server to the phone to indicate how to present the App. In reality I don’t think there is any magic behind it, it all comes down to how you design the different components metadata and a good API for them to communicate between each other.
You are right about server driven UI. The issue I lacked resources for was web and desktop development in Kotlin multi-platform in general. I don't know if the composition lifecycle for desktop is the same or how to manage it. I couldn't find answers on topics like or coroutine - navigation. I'm looking for resources for this.
p
Well the composition lifecycle is the same because it is the same compose engine/runtime code just compiled to different platforms. Composition lifecycle isn't complicated since it basically starts when the composable joins the composition and dies when the composable leaves it. Coroutine I don't think is directly related to server driven UI. Now, navigation indeed is. You have to really master a specific navigation library to be able to set up everything programmatically when receiving the UI metadata from the server. No local graphs or things like that. So whatever library you use has to have that feature.
Usually how it works is that you have certain components locally. These components form a tree 🌲. Then the tree starts building up as these components start adding children components to it. You get from the server the root component or you can ship a prefabricated tree as well.
Thanks for the explanations. I can stop dealing with the Lifecycle and focus on the other side.
👍 1
128 Views