
저번 글에서 CoroutineScope에 대해서 자세히 알아보았다면, 이제는 실전으로 안드로이드에서 제공하는 ViewModelScope와 lifecycleScope에 대해서 알아보자. ViewModelScope와 lifecycleScope는 코루틴의 생명주기를 효율적으로 관리할 수 있도록 도와주고, 각각 ViewModel과 LifecycleOwner에 연관된 코루틴 범위를 제공하고, 이를 통해 안드로이드 앱에서의 메모리 누수를 방지할 수 있다. ViewModelScopeCoroutineScope tied to this [ViewModel] This scope will be canceled when ViewModel will be cleared, i.e [ViewModel.onCleared] is call..