### Run Desktop App with Gradle Source: https://github.com/composegears/tiamat/blob/main/README.md Command to run the desktop application for the example project using the Gradle wrapper. ```Shell ./gradlew example:app:composeApp:run ``` -------------------------------- ### Creating a NavController with rememberNavController (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Creates and remembers a `NavController` instance, specifying the starting destination and providing an array of all available navigation destinations. ```kotlin val navController = rememberNavController( startDestination = Screen, destinations = arrayOf( Screen, AnotherScreen, // ... ) ) ``` -------------------------------- ### Run Web (Wasm) App with Gradle Source: https://github.com/composegears/tiamat/blob/main/README.md Command to run the WebAssembly (Wasm) version of the application for the example project in a browser using the Gradle wrapper. ```Shell ./gradlew example:app:composeApp:wasmJsBrowserRun ``` -------------------------------- ### Build Android Debug App with Gradle Source: https://github.com/composegears/tiamat/blob/main/README.md Command to assemble the debug version of the Android application for the example project using the Gradle wrapper. ```Shell ./gradlew example:app:composeApp:assembleDebug ``` -------------------------------- ### Declaring Nav Destinations with InstallIn (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet illustrates various valid ways to declare navigation destinations (NavDestination) and associate them with a TiamatGraph using the @InstallIn annotation. It includes examples using property delegates, constructors, and objects, highlighting that classes are not allowed directly. ```Kotlin // Using delegate @InstallIn(Graph::class) val Screen1 by navDestination { } // Using constructor @InstallIn(Graph::class) val Screen2 = NavDestination(name = "Screen2", extensions = emptyList()) {} // using object @InstallIn(Graph::class) object Screen3 : NavDestination { override val name: String = "Screen3" override val extensions: List> = emptyList() @Composable override fun NavDestinationScope.Content() { } } // NOT ALLOWED HERE class Screen4Class : NavDestination { override val name: String = "Screen4" override val extensions: List> = emptyList() @Composable override fun NavDestinationScope.Content() { } } // Using global instance property @InstallIn(Graph::class) @InstallIn(SomneOtherGraph::class) val Screen4 = Screen4Class() ``` -------------------------------- ### Adding Desktop System Back Handling in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md Provides an example of how to integrate system back button functionality for desktop applications using Tiamat. It shows how to access the global `NavBackHandler` and trigger its `back()` method in response to a key event, such as pressing the Escape key. ```kotlin fun main() = application { val backHandler = LocalNavBackHandler.current // < get ref to Global back handler Window( // ... onKeyEvent = { // < add global key event handler it.key == Key.Escape && it.type == KeyEventType.KeyUp && backHandler.back() // < call backHandler.back() }, // ... ) { App() } } ``` -------------------------------- ### Implementing and Applying a ContentExtension in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md This example illustrates how to create a custom `ContentExtension`, specifically an `Overlay` or `Underlay` type extension that can execute Composable code within the destination's scope. It shows implementing the `@Composable Content` function to perform actions like tracking screen views using `navEntry()` and applying the extension when defining a `navDestination`. ```kotlin // define extension class AnalyticsExt(private val name: String) : ContentExtension() { @Composable override fun NavDestinationScope.Content() { val entry = navEntry() LaunchedEffect(Unit) { LaunchedEffect(Unit) { val service = ... // receive tracker service.trackScreen(screenName = name, destination = entry.destination.name) } } } } // apply ext to screen val SomeScreen by navDestination( AnalyticsExt("SomeScreen") ) { // screen content } ``` -------------------------------- ### Combining Multiple Tiamat Graphs (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet shows how to combine multiple TiamatGraph objects using the '+' operator when initializing the NavController. This allows destinations from different graphs to be included in the navigation setup simultaneously. ```Kotlin ///... private object Graph1 : TiamatGraph private object Graph2 : TiamatGraph //... val nc = rememberNavController( key = "Key", startDestination = Screen1, graph = Graph1 + Graph2 ) ``` -------------------------------- ### rememberNavController Function Signature in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md This code block presents the function signature for `rememberNavController`. This function is the primary way to create and manage a `NavController` instance, which is responsible for handling navigation state, screen data, and view models. The parameters allow configuration of storage mode, start destination, and the set of available destinations. ```kotlin fun rememberNavController( key: String? = null, storageMode: StorageMode? = null, startDestination: NavDestination<*>? = null, destinations: Array, configuration: NavController.() -> Unit = {} ) ``` -------------------------------- ### Setting up Navigation with the NavController (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Sets up the navigation host using the created `navController`, typically within a Composable function. ```kotlin Navigation(navController) ``` -------------------------------- ### Setting up Tiamat Destinations Compiler Plugin and Library (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Applies the Tiamat destinations Kotlin compiler plugin and adds the corresponding library dependency to the common main source set for using destinations-based navigation. ```kotlin plugins { // Tiamat-destinations kotlin compiler plugin id("io.github.composegears.tiamat.destinations.compiler") version "$version" } sourceSets { commonMain.dependencies { // InstallIn annotations and Graph base class implementation("io.github.composegears:tiamat-destinations:$version") } } ``` -------------------------------- ### Navigating to Another Screen (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Demonstrates how to obtain the current `navController` within a destination's content and trigger navigation to another screen using `navController.navigate()`. ```kotlin val Screen by navDestination { val navController = navController() Column { Text("Screen") Button(onClick = { navController.navigate(AnotherScreen) }){ Text("Navigate") } } } ``` -------------------------------- ### Defining Screens and Navigating with Arguments in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md This snippet demonstrates how to define navigation destinations (screens) using `navDestination`, specifying the type of arguments they accept via generics. It shows how to navigate to another screen using `navController().navigate()` and pass data, and how to retrieve those arguments within the destination's scope using `navArgs()`. ```kotlin val RootScreen by navDestination { // ... val nc = navController() // ... nc.navigate(DataScreen, DataScreenArgs(1)) // ... } data class DataScreenArgs(val t: Int) val DataScreen by navDestination { val args = navArgs() } ``` -------------------------------- ### Applying Tiamat Destinations Compiler Plugin (Gradle) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet shows how to apply the Tiamat Destinations compiler plugin in the plugins block of a Gradle build script. This plugin is necessary for the automatic generation of navigation destination lists. ```Kotlin // Apply compiler plugin in the plugins section plugins { id("io.github.composegears.tiamat.destinations.compiler") version "$version" } ``` -------------------------------- ### Adding Tiamat Multiplatform Dependencies (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Adds the core Tiamat library and the Koin integration dependency to the common main source set in a Compose Multiplatform project's build.gradle.kts file. ```kotlin sourceSets { commonMain.dependencies { // core library implementation("io.github.composegears:tiamat:$version") // Koin integration (https://github.com/InsertKoinIO/koin) implementation("io.github.composegears:tiamat-koin:$version") } } ``` -------------------------------- ### Performing Immediate Navigation Actions with rememberNavController Configuration in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md Demonstrates how to use the configuration lambda provided by `rememberNavController`. This lambda is executed immediately after the controller is created or restored, allowing navigation actions (like handling a deeplink) to occur before the first screen is drawn, thus preventing a potential 1-frame animation flicker. ```kotlin // LaunchEffect & DisposableEffect are executed on `next` frame, so you may see 1 frame of animation // to avoid this effect use `configuration` lambda within `rememberNavController` fun // see DeeplinkScreen.kt val deeplinkNavController = rememberNavController( key = "deeplinkNavController", startDestination = ShopScreen, destinations = arrayOf(ShopScreen, CategoryScreen, DetailScreen) ) { // executed right after being created or restored // we can do nav actions before 1st screen bing draw without seeing 1st frame if (deeplink != null) { editBackStack { clear() add(ShopScreen) add(CategoryScreen, deeplink.categoryId) } replace( dest = DetailScreen, navArgs = DetailParams(deeplink.productName, deeplink.productId), transition = navigationNone() ) clearFreeArgs() } } ``` -------------------------------- ### Dump Public API with Gradle Source: https://github.com/composegears/tiamat/blob/main/README.md Command to generate a dump of the project's public API using the Gradle wrapper. Useful for tracking API changes. ```Shell ./gradlew apiDump ``` -------------------------------- ### Handling Complex Navigation and Deeplinks in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md Illustrates two common approaches for managing complex navigation flows or handling deeplinks in Tiamat. Idea 1 uses `freeArgs` and `rememberNavController` configuration lambda to build the back stack. Idea 2 utilizes the experimental `route` API to define a sequence of destinations. ```kotlin // there is 2 common ideas behind handle complex navigation //---- idea 1 ----- // create some data/param that will be passed via free args // each screen handle this arg and opens `next` screen val DeeplinkScreen by navDestination { val deeplink = freeArgs() // take free args val deeplinkNavController = rememberNavController( key = "deeplinkNavController", startDestination = ShopScreen, destinations = arrayOf(ShopScreen, CategoryScreen, DetailScreen) ) { // handle deeplink and open next screen // passing eitthe same data or appropriate parts of it if (deeplink != null) { editBackStack { clear() add(ShopScreen) add(CategoryScreen, deeplink.categoryId) } replace( dest = DetailScreen, navArgs = DetailParams(deeplink.productName, deeplink.productId), transition = navigationNone() ) clearFreeArgs() } } Navigation(modifier = Modifier.fillMaxSize(), navController = deeplinkNavController) } //---- idea 2 ----- // use route-api if (deeplink != null) { @OptIn(TiamatExperimentalApi::class) navController?.route( Route.build( ShopScreen.toNavEntry(), CategoryScreen.toNavEntry(navArgs = deeplink.categoryId), DetailScreen.toNavEntry(navArgs = DetailParams(deeplink.productName, deeplink.productId)), ) ) deepLinkController.clearDeepLink() } ``` -------------------------------- ### Defining a NavDestination (Chaotic Neutral Style) (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Defines a navigation destination using the 'chaotic neutral' style, explicitly providing the screen name as a string to the `NavDestination` constructor. ```kotlin val Screen = NavDestination("ScreenName") { // content } ``` -------------------------------- ### Adding Tiamat Destinations Library Dependency (Gradle) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet demonstrates how to add the Tiamat Destinations library as an implementation dependency in the commonMain source set using Gradle Kotlin DSL. Ensure the correct library version is specified. ```Kotlin // Add dependency sourceSets { commonMain.dependencies { implementation("io.github.composegears:tiamat-destinations:$version") } } ``` -------------------------------- ### Defining a NavDestination (Chaotic Evil Style) (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Defines a navigation destination using the 'chaotic evil' style, implementing the `NavDestination` interface and explicitly defining the name and content. ```kotlin object Screen : NavDestination { override val name: String = "ScreenName" @Composable override fun NavDestinationScope.Content() { // content } } ``` -------------------------------- ### Apache License Version 2.0 Source: https://github.com/composegears/tiamat/blob/main/README.md The full text of the Apache License, Version 2.0, under which the project is licensed. ```Text Developed by ComposeGears 2025 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### Check API Changes with Gradle Source: https://github.com/composegears/tiamat/blob/main/README.md Command to check for changes in the project's public API against a baseline using the Gradle wrapper. ```Shell ./gradlew apiCheck ``` -------------------------------- ### Creating a TiamatGraph Object (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet shows the basic declaration of a custom navigation graph object by extending the TiamatGraph interface. This object serves as a container for the automatically generated navigation destinations. ```Kotlin private object Graph : TiamatGraph ``` -------------------------------- ### Using TiamatGraph with rememberNavController (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet demonstrates how to use the created TiamatGraph object when initializing the NavController with rememberNavController. The graph parameter is used instead of manually providing a list of destinations. ```Kotlin val nc = rememberNavController( key = "Key", startDestination = Screen1, graph = Graph // use it here ) ``` -------------------------------- ### Defining a NavDestination (Chaotic Good Style) (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/README.md Defines a navigation destination using the 'chaotic good' style, where the screen name is implicitly derived from the value name. This uses the `navDestination` delegate. ```kotlin val Screen by navDestination { // content } ``` -------------------------------- ### Using rememberNavController and Navigation Composable in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md This snippet demonstrates the typical usage of `rememberNavController` within a Composable function. It shows how to obtain a `NavController` instance and then pass it to the `Navigation` composable, which is responsible for rendering the content of the currently active screen based on the controller's state. Modifiers can be applied to the `Navigation` composable. ```kotlin @Composable fun Content() { val navController = rememberNavController( /*... */) Navigation( navController = navController, modifier = Modifier.fillMaxSize().systemBarsPadding() ) } ``` -------------------------------- ### Demonstrating Recursive Type Error in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md Shows a common IDE error ("Type checking has run into a recursive problem") that occurs when using `navDestination` with circular dependencies between screens without explicitly specifying the generic type parameters. The error is highlighted in the `navController.navigate` calls. ```kotlin val SomeScreen1 by navDestination { val navController = navController() Button( onClick = { navController.navigate(SomeScreen2) }, // << error here content = { Text("goScreen2") } ) } val SomeScreen2 by navDestination { val navController = navController() Button( onClick = { navController.navigate(SomeScreen1) }, // << or here content = { Text("goScreen2") } ) } ``` -------------------------------- ### Manually Defining Graph Destinations (Kotlin) Source: https://github.com/composegears/tiamat/blob/main/tiamat-destinations-compiler/README.md This snippet provides an emergency workaround by manually overriding the destinations() function within the TiamatGraph object. This requires explicitly listing all destinations and disabling the compiler plugin. ```Kotlin private object Graph : TiamatGraph { override fun destinations(): Array> = arrayOf( Screen1, Screen2, Screen3 ) } ``` -------------------------------- ### Fixing Recursive Type Error with Explicit Type in Tiamat Kotlin Source: https://github.com/composegears/tiamat/blob/main/README.md Provides the solution to the recursive type checking error by explicitly defining the type of the `NavDestination` variable. This helps the compiler resolve the types correctly and avoids the recursive problem. ```kotlin val SomeScreen1: NavDestination by navDestination { /* ... */ } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.