Skip to content

Instantly share code, notes, and snippets.

@psteiger
Created June 29, 2019 21:00
Show Gist options
  • Save psteiger/20e3371f8d8ab39a10fd58cb05413a97 to your computer and use it in GitHub Desktop.
Save psteiger/20e3371f8d8ab39a10fd58cb05413a97 to your computer and use it in GitHub Desktop.
inline fun <X, Y> LiveData<Resource<X>>.mapLiveDataResource(
crossinline transform: (X) -> Y
): LiveData<Resource<Y>> =
map { it.mapResource(transform) }
// map from androidx.lifecycle:lifecycle-livedata-ktx
// Equivalent to Transformations.map(source, func)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment