Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created June 23, 2022 16:51
Show Gist options
  • Save anupamchugh/41e99c140c9790472eb1d8ac6cda7163 to your computer and use it in GitHub Desktop.
Save anupamchugh/41e99c140c9790472eb1d8ac6cda7163 to your computer and use it in GitHub Desktop.
struct RowListsView : View{
@EnvironmentObject var router: Router
var body: some View{
Form{
List(1..<5) { i in
NavigationLink(value: i) {
Text("\(i)")
}
}
Section{
if router.path.count > 0
{
Button("Screen count \(router.path.count)"){
print("")
}
Button("Pop to root", role: .destructive){
router.path = .init()
}
Button("Jump back two screens", role: .none){
if router.path.count >= 2{
router.path.removeLast(2)
}
else if router.path.count >= 1{
router.path.removeLast(1)
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment