Slide 17
Slide 17 text
Bonus: より簡潔に
拡張関数を活用すると良さそう(ktxにある?)
Transformations.switchMap(_userId) {
profileRepository.getProfile(it)
}
_userId.switchMap {
profileRepository.getProfile(it)
}
fun LiveData.switchMap(body: (X) -> LiveData):
LiveData {
return Transformations.switchMap(this, body)
}
長い
シンプル
https://github.com/google/iosched ͷ Extensions.kt ΑΓ