From the course: Kotlin Multiplatform Development
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Google ViewModel - Kotlin Tutorial
From the course: Kotlin Multiplatform Development
Google ViewModel
- [Instructor] To support compose multi-platform, Google offers the common view model library as part of its Jetpack series of libraries. In this video, we'll use Google's common view model to share code across platforms. First, we're going to go into our project, which I have here, and we have to paste in the Gradle dependency for lifecycle view model compose into the dependency section for our app. As you can see here, I already have it added to my libs versions two ml file. This is the version number, and here, I use the version number further down right here, and referencing it here. That's the one. You have to correctly spell all of this. We're going to put a link in so that you can see the documentation for how to add this. It's right here. You're basically doing the same thing here, except we're just using the Gradle version catalogs to define it, right here. So we've added the lifecycle view model compose, as well as androidx-lifecycle-runtime-compose, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.