# Koin ViewModel Scope

> Koin ViewModel Scope in the Mobile Action Pro course.

- URL: https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/07-dependency-injection/lesson-05-koin-viewmodel-scope
- Course: [Mobile Action Pro](https://dantech.academy/en/courses/kotlin-accelerator.md)
- Module: Dependency Injection with Koin
- Duration: 25 min
- Difficulty: intermediate
- Access: Enrolled students
- Tiếng Việt: https://dantech.academy/courses/kotlin-accelerator/engineer-builder/07-dependency-injection/lesson-05-koin-viewmodel-scope.md

## Objectives

- Declare ViewModels with viewModelOf or viewModel { } and know when you need the lambda
- Use androidx.lifecycle.ViewModel in commonMain for Android and iOS
- Explain ViewModelStoreOwner and the ViewModel lifecycle tied to the back stack entry

## In this lesson

1. Lesson Goal
2. Part 1: ViewModels In commonMain
3. Part 2: viewModelOf
4. Part 3: The viewModel Lambda When You Create A Parameter Yourself
5. Part 4: Who Holds The Instance
6. Part 5: Designing Around That Lifecycle
7. Practice Exercise
8. Code Reading Path
9. Signs To Avoid
10. References
11. Key Points

## Study with an AI agent

The full lesson is for students of this course. Students open the lesson on the web and press **Markdown** to copy all of it, then paste it into Claude, ChatGPT, Cursor or whichever agent you use. Faster: mint a token at `/profile/ai-agents` and your agent reads lessons over MCP.

- [Join the course](https://dantech.academy/en/kotlin-accelerator/checkout)

---

- Previous lesson: [Koin DSL: module, single, factory](https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/07-dependency-injection/lesson-04-koin-dsl-basics.md)
- Next lesson: [Dependency Resolution With get()](https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/07-dependency-injection/lesson-06-dependency-resolution.md)
