Skip to content
ohitsdaniel edited this page Feb 5, 2021 · 3 revisions

Root

Root View of any ComposableNavigator driven application

public struct Root<Builder: PathBuilder>: View

Embeds the content in a NavigationView and builds the routing path, whenever it changes.

Usage

import ComposableNavigator
import SwiftUI

let appBuilder: PathBuilder = PathBuilders.screen(
  HomeScreen.self,
  content: { HomeView(...) },
  nesting: PathBuilders.anyOf(
    DetailScreen.builder(...),
    SettingsScreen.builder(...)
 )
)

@main
struct ExampleApp: App {
  let dataSource = Navigator.Datasource(root: HomeScreen())

  var body: some Scene {
    WindowGroup {
      Root(
       dataSource: dataSource,
       pathBuilder: appBuilder
     )
    }
  }
}

Inheritance

View

Initializers

init(dataSource:navigator:pathBuilder:)

public init(dataSource: Navigator.Datasource, navigator: Navigator, pathBuilder: Builder)

init(dataSource:pathBuilder:)

init(dataSource: Navigator.Datasource, pathBuilder: Builder)

Properties

body

var body: some View

Methods

debug()

Enable logging function calls to the Navigator object and path changes.

func debug() -> Root
Clone this wiki locally