Closed jeemyeong closed 3 years ago
What exactly do you mean with nested route? You can place a Route anywhere in your View hierarchy (as long as it's inside a Router). Even Routes inside Routes, using relative paths:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
Router(initialPath: "/one/two/three") {
Route(path: "one/*") {
Text("One")
Route(path: "two/*") {
Text("Two")
Route(path: "three") {
Text("Three")
}
}
}
}
}
}
}
Just make sure to use *
at the end of a path to also match deeper paths. (E.g.: /one
would not match /one/two
, but /one/*
does match)
Thank you, I exactly got what I want. 👍
Hi, I am using this library.
I cannot find out how to use nested route, so is it able to use nested route? If available, could you give me some examples?