-
Notifications
You must be signed in to change notification settings - Fork 25
Root
ohitsdaniel edited this page Apr 29, 2021
·
3 revisions
Root View of any ComposableNavigator driven application
public struct Root<Builder: PathBuilder>: View
Embeds the content in a NavigationView
and builds the navigation path, whenever it changes.
import ComposableNavigator
import SwiftUI
struct AppNavigationTree: NavigationTree {
let homeViewModel: HomeViewModel
let detailViewModel: DetailViewModel
let settingsViewModel: SettingsViewModel
var builder: some PathBuilder {
Screen(
HomeScreen.self,
content: {
HomeView(viewModel: homeViewModel)
},
nesting: {
DetailScreen.Builder(viewModel: detailViewModel),
SettingsScreen.Builder(viewModel: settingsViewModel)
}
)
}
}
@main
struct ExampleApp: App {
let dataSource = Navigator.Datasource(root: HomeScreen())
var body: some Scene {
WindowGroup {
Root(
dataSource: dataSource,
pathBuilder: AppNavigationTree(...)
)
}
}
}
View
public init(
dataSource: Navigator.Datasource,
navigator: Navigator,
pathBuilder: Builder
)
init(
dataSource: Navigator.Datasource,
pathBuilder: Builder
)
public var body: some View
Enable logging function calls to the Navigator object and path changes.
func debug() -> Root
Generated at 2021-04-29T07:59:04+0000 using swift-doc 1.0.0-beta.6.
Types
- AnyPathBuilder
- AnyScreen
- Deeplink
- DeeplinkComponent
- DeeplinkComponent.Argument
- DeeplinkHandler
- DeeplinkParser
- EitherAB
- EitherABC
- EitherABCD
- EitherABCDE
- EitherABCDEF
- EitherABCDEFG
- EitherABCDEFGH
- EitherABCDEFGHI
- EitherABCDEFGHIJ
- IdentifiedScreen
- NavigationNode
- NavigationTreeBuilder
- Navigator
- Navigator.Datasource
- Navigator.DidAppearInvocation
- Navigator.DismissInvocation
- Navigator.GoBackToInvocation
- Navigator.GoToInvocation
- Navigator.GoToPathInvocation
- Navigator.NavigationIdentifier
- Navigator.ReplaceContentInvocation
- Navigator.ReplacePathInvocation
- Navigator.ReplaceScreenInvocation
- NavigatorKey
- OnDismissView
- PathBuilders
- PathBuilders.EmptyBuilder
- PathBuilders.WildcardView
- PathComponentUpdate
- PathUpdate
- Root
- ScreenPresentationStyle
- TreatSheetDismissAsAppearInPresenterKey
- _PathBuilder