Guia Navigation
Github
  • Overview
  • Setup
  • Using Guia
    • 📔Express Lore
      • Quick Start
    • 📖The Lore
      • Navigation Key
      • Navigation Node
        • Screen
        • Bottom Sheet
        • Dialog
      • Navigator
        • Navigation Operations
        • Navigator Instance
        • Back Handling
      • Navigator Config
        • Dynamic Navigation Node
        • Transitions
      • Containers
      • NavHost
        • Back Handling
      • Multi module navigation
        • NavHost Multi module
      • Deep Linking / Global Navigation
      • Results
      • Lifecycle, ViewModel, Saved State
      • UI Tests
  • 🤖Advanced
    • Custom LifecycleManager
Powered by GitBook
On this page
  1. Using Guia
  2. The Lore

Navigation Key

PreviousThe LoreNextNavigation Node

Last updated 2 years ago

A NavigationKey represents an entry in our navigation flow. The key itself does not have any UI representation or UI logic. It can have arguments which is how argument passing works using Guia. All arguments must be Parcelable, since the key is saved and restored.

To create a key:

@Parcelize
class ProfileKey(val profileId: String): NavigationKey

The reason why the key is not tied to the UI directly is to make multi module navigation easier.

We will see later how we can tie a key to and render some UI.

Self hosted NavigationKey

However, not all projects are multi module, to make it easier to have support for both multi module and single module applications, or even modules that have their own navigation flows and don't require this separation within that module, we can use NavigationKey.WithNode<NavigationNode>:

@Parcelize
class ProfileKey(val profileId: String): NavigationKey.WithNode<Screen> {

    override fun navigationNode() = Screen { 
        Text("Profile: $profileId")
    }
}
📖
NavigationNode