ar-g
08/10/2017, 12:51 PMsealed class PaginationViewState<T> {
object LoadingFirstPage: PaginationViewState<T>()//doesn't work
object LoadingPage: PaginationViewState<T>()//doesn't work
data class DataLoaded<T>(val data: List<T>): PaginationViewState<T>()
data class DataLoadedFromCache<T>(val data: List<T>): PaginationViewState<T>()
data class Failure<T>(val e: Throwable): PaginationViewState<T>()
}
marstran
08/10/2017, 12:54 PMT
for your objects.marstran
08/10/2017, 12:55 PMar-g
08/10/2017, 12:55 PMmarstran
08/10/2017, 12:56 PMT
has to be an actual class/interface here: object LoadingFirstPage : PaginationViewState<T>()
marstran
08/10/2017, 12:57 PMPaginationViewState
with a type parameter.ar-g
08/10/2017, 12:57 PMobject LoadingFirstPage<T>: PaginationViewState<T>()
marstran
08/10/2017, 12:57 PMLoadingFirstPage
. It can't take parameters.marstran
08/10/2017, 12:58 PMLoadingFirstPage
should be a class then?ar-g
08/10/2017, 12:58 PMmarstran
08/10/2017, 1:09 PMT
is the type of data that the view state holds, so LoadingFirstPage
and LoadingPage
are classes, not objects.marstran
08/10/2017, 1:17 PMAny
is what you were looking for. I really don't think you should do that. You are losing type information that you don't have to lose.ar-g
08/10/2017, 1:21 PMPaginationViewState<AdModel> =PaginationViewState.LoadingFirstPage
. I'll stick with regular classes probablymarstran
08/10/2017, 1:46 PM