Use Routing along side Presenting #25
Closed
FabioFiorita
started this conversation in
General
Replies: 1 comment
-
Yes you can use both! I've found that this works best: import Presenting
import Routing
import SwiftUI
struct ContentView: View {
private let presenter: Presenter<ContentSheetRoute>
private let router: Router<ContentRoute>
private init(router: Router<ContentRoute>, presenter: Presenter<ContentSheetRoute>) {
self.router = router
self.presenter = presenter
}
var body: some View {
// main content
}
}
extension ContentView {
static func make() -> some View {
PresentingView(ContentSheetRoute.self) { presenter in
RoutingView(ContentRoute.self) { router in
ContentView(router: router, presenter: presenter)
}
}
}
}
// Then you can use this View Factory method to create the View instead of the initializer
ContentView.make() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to use on the same Root View both Presenting and Routing packages?
Beta Was this translation helpful? Give feedback.
All reactions