Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class PostsDataSourceFactory(
private val apiService: PostsService,
private val compositeDisposable: CompositeDisposable
): DataSource.Factory<Int, Posts>(){
val postsLiveDataSource = MutableLiveData<PostsDataSource>()
override fun create(): DataSource<Int, Posts> {
val postsDataSource = PostsDataSource(apiService, compositeDisposable)
postsLiveDataSource.postValue(postsDataSource)
return postsDataSource
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment