forXifLess / LinkNavigator

🌊 Easy & Powerful navigation library in SwiftUI
Other
324 stars 22 forks source link

constructor in view #38

Closed mojtabasheikhy closed 6 hours ago

mojtabasheikhy commented 1 week ago

struct TurnStatusView: View { @State public var terminal :Terminal public init(terminal : Terminal,navigator : LinkNavigatorType) { self.terminal = terminal } } public struct TurnStatusRouteBuilder: RouteBuilder { public var matchPath: String { "TurnStatus" } public init(){} public var build: (LinkNavigatorType, [String: String], DependencyType) -> MatchingViewController? { { navigator, items, dependency in return WrappingController(matchPath: matchPath) { TurnStatusView(navigator: navigator) } } } } how pass terminal as constructor

interactord commented 1 week ago

Hello! @mojtabasheikhy

There is a lack of clues as to what is wrong or uncomfortable about the issue.

If you have asked about the possibility of using @State in RouteBuilder, it is not possible.

However, it can be used in other ways. You can inject the State value directly into the View. We can also pass dependencies through DependencyType.

I hope this is the correct answer.

interactord commented 1 week ago

To enable enterprise utilization, here is an example available in libraries utilizing various architectures.

Please also refer to the link provided.

https://github.com/interactord/Boost

interactord commented 6 hours ago

dear. @mojtabasheikhy

We will close the issue as there has been no response for 2 weeks. If you provide any additional information, we will proceed with the issue.

Thank you.