When Composable met ViewModel & LiveData : Jetpack Compose - 10/46

preview_player
Показать описание
In this video, we tackle a common problem in Jetpack Compose: keeping business logic inside the composable functions. This can lead to an unmaintainable codebase, so we need a better architecture. The solution? Moving your business logic out of the composable and into a ViewModel!

We’ll walk through how to refactor your code to separate the logic that manages the state of a counter from the composable view to a Jetpack ViewModel. This tutorial revisits some key concepts covered in our Android App Architecture series, ensuring you have a solid understanding of ViewModel and LiveData.

Here’s what we’ll cover:

1. Identifying the problem of business logic in composable functions.
2. Moving this logic to a separate ViewModel class.
3. Utilizing Jetpack’s LiveData to create an observable state.
4. Implementing and observing state changes in your composable.

By the end of this video, you’ll have a clean architecture that separates your business logic from the UI, making your Jetpack Compose apps more maintainable and scalable.

Stay tuned for more in-depth explorations of Jetpack Compose in our upcoming videos!

Don’t forget to like, comment, share this video, and subscribe to the channel for more coding tutorials. Take care, and happy coding!

#JetpackCompose #AndroidDevelopment #ViewModel #LiveData #AndroidArchitecture #ComposableFunctions #Jetpack #AndroidStudio #MobileAppDevelopment #CodeTutor #AnilDeshpande #ProgrammingTutorial #CleanCode #Kotlin #AndroidJetpack


Рекомендации по теме
Комментарии
Автор

Jetpack Compose video 9 and 10 have minor audio issues. The audio volume is bit feeble due to technical issue while exporting the video. It was inadvertent mistake. Please use head phones/ ear buds for these two videos. From next video onwards, I have taken care to ensure that this issue doesn't repeat. Thanks in advance 🙏🏼

Codetutor-DemystifyCoding
Автор

Now things are getting interesting, looking forward for the next videos. Thank you for being consistent.

connectkushal
Автор

I really admire your videos, and learned a lot. Just the audio and video quality is not great as previous tutorial series.

rocksolid
Автор

hey nice content bro but i suggest you buy a mic your voice is too low and cant be heard well even on max volume, thanks tho

CollinsKibe
Автор

Mutablelive data should be private to a viewmodel. how are you accessing in a view ??

benarjee
Автор

Here am getting exception at line number 43 as CompositionLocal LocalLifecycleOwner not present. Anyone facing same issue? Any solution?

srikrishnasateeshmutyam