这是indexloc提供的服务,不要输入任何密码
Skip to content
/ treeNav Public

A kotlin multiplatform experiment for representing app navigation with tree like data structures

License

Notifications You must be signed in to change notification settings

tunjid/treeNav

Repository files navigation

TreeNav

JVM Tests TreeNav

Please note, this is not an official Google repository. It is a Kotlin multiplatform experiment that makes no guarantees about API stability or long term support. None of the works presented here are production tested, and should not be taken as anything more than its face value.

Introduction

TreeNav is a kotlin multiplatform experiment for representing app navigation with tree like data structures. This library is merely a declaration of interfaces and well tested types. Integration is open ended and left to the consuming application. An example of such an implementation can be found here.

The basic type defined is the Node interface.

interface Node {
    val id: String

    val children: List<Node> get() = listOf()
}

Nodes may be:

  • Routes: Simple destinations that represent a UI
  • Parent Nodes: Nodes with specific navigation semantics, the library currently offers 2:
    • StackNav: Offers push pop semantics for stack based navigation.
    • MultiStackNav: A compound Node comprising of multiple StackNav instances with the added convenience of being able to switch stacks as well as the push and pop behaviors from StackNav.

The above makes it easy to represent the following navigation structure:

root_multi_stack_nav
├─ tab_1/
│  ├─ article_list
│  ├─ article_detail_a
│  ├─ article_author_a
├─ tab_2/
│  ├─ user_profile
│  ├─ edit_profile
├─ tab_3
│  ├─ favorites

License

Copyright 2021 Google LLC

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

    https://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.

About

A kotlin multiplatform experiment for representing app navigation with tree like data structures

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages