Passing data in preview with a viewModel is easy but how do i pass data when i have some kind of generic data? Can't find a proper answer on google. In this particular app i'm implementing the Router design pattern can be found here (https://github.com/obvios/Routing). The preview is asking me to pass an argument for parameter ''router'' but this is quite different like when you do with a viewModel normally i'd pass viewModel: ExampleViewModel(). So i don't know what exactly to pass in the Preview? Autocomplete is not helpful.
import SwiftUI
import Routing
struct ContentView: View {
var body: some View {
RoutingView(BasicsRouter.self) { router in
BasicsView(router: router)
}
}
}
struct BasicsView: View {
@StateObject var router: Router<BasicsRouter>
init(router: Router<BasicsRouter>) {
_router = StateObject(wrappedValue: router)
}
var body: some View {
VStack {
Text("Hello")
}
}
}
#Preview {
BasicsView()
}