-
-
Save anupamchugh/41e99c140c9790472eb1d8ac6cda7163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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