#if canImport(UIKit) && !os(watchOS) import UIKit extension NavigationStackController { /// Drives a navigation stack controller with a store. /// /// See the dedicated article on for more information on the library's /// navigation tools, and in particular see for information on using /// this view. /// /// - Parameters: /// - navigationBarClass: Specify the custom `UINavigationBar` subclass you want to use, or /// specify `nil` to use the standard `UINavigationBar` class. /// - toolbarClass: Specify the custom `UIToolbar` subclass you want to use, or specify `nil` /// to use the standard `UIToolbar` class. /// - path: A binding to a store of stack state. /// - root: A root view controller. /// - destination: A function to create a `UIViewController` from a store. /// - fileID: The source `#fileID` associated with the controller. /// - filePath: The source `#filePath` associated with the controller. /// - line: The source `#line` associated with the controller. /// - column: The source `#column` associated with the controller. public convenience init( navigationBarClass: AnyClass? = nil, toolbarClass: AnyClass? = nil, path: UIBinding, StackAction>>, root: () -> UIViewController, destination: @escaping (Store) -> UIViewController, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column ) { self.init( navigationBarClass: navigationBarClass, toolbarClass: toolbarClass, path: path[ fileID: _HashableStaticString(rawValue: fileID), filePath: _HashableStaticString(rawValue: filePath), line: line, column: column ], root: root ) navigationDestination(for: StackState.Component.self) { component in var element = component.element return destination( path.wrappedValue.scope( id: path.wrappedValue.id( state: \.[ id:component.id,fileID:_HashableStaticString( rawValue: fileID),filePath:_HashableStaticString( rawValue: filePath),line:line,column:column ], action: \.[id:component.id] ), state: ToState { element = $0[id: component.id] ?? element return element }, action: { .element(id: component.id, action: $0) }, isInvalid: { !$0.ids.contains(component.id) } ) ) } } } #endif