All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.arkivanov.decompose.router.pages.Pages.kt Maven / Gradle / Ivy

There is a newer version: 3.2.0-beta01
Show newest version
package com.arkivanov.decompose.router.pages

/**
 * Represents a state of Child Pages navigation model.
 *
 * @param items a list of child configurations, must be unique, can be empty.
 * @param selectedIndex an index of the selected child configuration.
 * Must be within the range of [items] indices if [items] is not empty, otherwise can be any number.
 */
data class Pages(
    val items: List,
    val selectedIndex: Int,
) {

    /**
     * Creates empty [Pages].
     */
    constructor() : this(items = emptyList(), selectedIndex = -1)

    init {
        if (items.isNotEmpty()) {
            require(selectedIndex in items.indices) {
                "The selectedIndex argument must be with the range: ${items.indices}. Actual: $selectedIndex."
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy