밑빠진 지식에 블로그 쓰기

Scope Function 본문

카테고리 없음

Scope Function

쓰는녀석 2023. 3. 31. 22:35

apply 

This may be the first time you're seeing the apply function in Kotlin. apply is a scope function in the Kotlin standard library. It executes a block of code within the context of an object. It forms a temporary scope, and in that scope, you can access the object without its name. The common use case for apply is to configure an object. Such calls can be read as "apply the following assignments to the object."

https://developer.android.com/codelabs/basic-android-kotlin-training-shared-viewmodel?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-4%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-shared-viewmodel#5 

 

프래그먼트 간 공유되는 ViewModel  |  Android Developers

고급 앱 예를 통해 Jetpack Navigation 구성요소를 사용해보고 활동의 여러 프래그먼트 간에 공유 ViewModel을 보유할 경우의 이점에 관해 알아봅니다.

developer.android.com