Popularity
1.6
Stable
Activity
0.0
Declining
23
9
4

Description

A lightweight library to help you navigate in compose with well typed functions.

Programming language: Kotlin
Tags: Kotlin     UI     Android     Navigation     Android-library     Compose    

TypedNavigation alternatives and similar packages

Based on the "Navigation" category.
Alternatively, view TypedNavigation alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of TypedNavigation or a related project?

Add another 'Navigation' Package

README

TypedNavigation

Run detekt and build

A lightweight library to help you navigate in compose with well typed functions.

Installation:

You can add this library to your project by just adding the following code to your root build.gradle

allprojects {
    repositories {
        // ...
        maven { url 'https://jitpack.io' }
    }
}

Then import the library in your app build.gradle file.

implementation 'com.github.xmartlabs:TypedNavigation:0.0.2'

Usage:

You just have to define your screens and the arguments they receive:

object Router {
    val default = TypedNavigation.E("default")
    val sample = TypedNavigation.A3("sample", NavType.StringType, NavType.StringType, NavType.StringType)
}

And after that the library will provide you with the following functions:

To add your screen to the NavHost:

setContent {
    val navigationController: NavHostController = rememberNavController()
    NavHost(navController = navigationController, startDestination = Router.default.url) {
        composable(Router.default) {
            Default(navigationController = navigationController)
        }
        composable(Router.sample) { a: String?, b: String?, c: String? ->
            Sample(a, b, c)
        }
    }
}

To navigate from one screen to another:

navigationController.navigate(Router.sample.route("a", "b", "c"))

Add deep linking to your screen by setting up the correct path to the url:

   val sample =
    TypedNavigation.A3("sample", NavType.StringType, NavType.StringType, NavType.StringType,
        listOf { a1, a2, a3 -> // a1, a2 and a3 contains the keys for the attributes previously defined
            "www.example.com/$a1/$a2/$a3" 
        }
    )

For more examples you can check out our sample app.

About

Made with โค๏ธ by XMARTLABS