Created
September 22, 2021 15:16
-
-
Save tjmaynes/15baf4d900047dd44cf7775e3010ff98 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ContentView: View { | |
| @State private var selection: String? | |
| var body: some View { | |
| NavigationView { | |
| VStack { | |
| ButtonView( | |
| message: "First screen", | |
| buttonTitle: "Tap me!", | |
| onTap: { self.selection = "view-2" } | |
| ) | |
| NavigationLink( | |
| destination: ButtonView( | |
| message: "Second screen", | |
| buttonTitle: "Tap me, again!", | |
| onTap: { self.selection = "view-3" } | |
| ), | |
| tag: "view-2", | |
| selection: self.$selection | |
| ) { EmptyView() } | |
| NavigationLink( | |
| destination: ButtonView( | |
| message: "Third screen", | |
| buttonTitle: "One more time...", | |
| onTap: { self.selection = "view-4" } | |
| ), | |
| tag: "view-3", | |
| selection: self.$selection | |
| ) { EmptyView() } | |
| NavigationLink( | |
| destination: Text("Final screen"), | |
| tag: "view-4", | |
| selection: self.$selection | |
| ) { EmptyView() } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment