Quick Start

Setup and Usage

Basically

Define your UI data

Define your source, design its requirements

Use the source definition in pageable in your view model

Convert the pageable to usable state in your UI

Optionally configure the strategy for pageable. See Pageable Strategies

Example Structure

yourFeature/YourModel.kt
class YourModel(source: YourSource, coroutineScope: CoroutineScope) {
    // the default startegies use Int as page key/index,
    // but any page key type you want is possible   
    val yourPageableageable = pageable(
        coroutineScope,
        onPage = { index -> source.getPage(index) },
        strategy = prefetchPageAmount( // one of the default strategies
            initialPage = 0, 
            pageAmountSurroundingVisible = 2
        )
    )
}
Icon