Skip to content

Dilivva/Ballast-Nav-Sample-App

Repository files navigation

Ballast Navigation with KSP demo project

License

This is a demo project to showcase using Ballast navigation in a typesafe way using KSP. The app is a basic Kotlin Multiplatform app using a template generated from KMM-Template for Android and iOS. It includes shared business logic and data handling, and a shared UI implementation using Compose Multiplatform.

Overview

Declare screens using a sealed interface/class

@Routes
sealed interface Screen{
    @InitialRoute
    data object ListScreen: Screen

    data class DetailScreen(val objectId: Int): Screen

    data class Settings(val count: Double): Screen
}

Build and have:

val coroutineScope = rememberCoroutineScope()
    val controller = rememberController(coroutineScope)

    Destination(
        controller,
        onNavigate = {
            when(it){
                is Screen.DetailScreen -> DetailScreen(it.objectId)
                is Screen.ListScreen -> ListScreen()
                is Screen.Settings -> TODO()
            }
        }
    )

Technologies

The data displayed by the app is from The Metropolitan Museum of Art Collection API.

The app uses the following multiplatform dependencies in its implementation:

This is experimental and not ready for production

About

A poc app for type-safe navigation with Ballast

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published