File tree Expand file tree Collapse file tree
Examples/SingleNavigator/01-SingleBasic/SingleBasic/Page Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import LinkNavigator
44struct HomeView : View {
55
66 let navigator : RootNavigatorType
7+ @State private var paths : [ String ] = [ ]
78
89 var body : some View {
910 VStack ( spacing: 30 ) {
10- PathIndicator ( currentPath: navigator . getCurrentPaths ( ) . joined ( separator: " -> " ) )
11+ PathIndicator ( currentPath: paths . joined ( separator: " -> " ) )
1112 . padding ( . top, 32 )
1213
1314 Button ( action: {
@@ -51,5 +52,8 @@ struct HomeView: View {
5152 Spacer ( )
5253 }
5354 . padding ( )
55+ . onAppear {
56+ paths = navigator. getCurrentPaths ( )
57+ }
5458 }
5559}
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import LinkNavigator
44struct Page1View : View {
55
66 let navigator : RootNavigatorType
7+ @State private var paths : [ String ] = [ ]
78
89 var body : some View {
910 VStack ( spacing: 30 ) {
10- PathIndicator ( currentPath: navigator . getCurrentPaths ( ) . joined ( separator: " -> " ) )
11+ PathIndicator ( currentPath: paths . joined ( separator: " -> " ) )
1112 . padding ( . top, 32 )
1213
1314 Button ( action: {
@@ -44,6 +45,9 @@ struct Page1View: View {
4445 Spacer ( )
4546 }
4647 . padding ( )
48+ . onAppear {
49+ paths = navigator. getCurrentPaths ( )
50+ }
4751 }
4852}
4953
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ struct Page2View: View {
88
99 var body : some View {
1010 VStack ( spacing: 30 ) {
11- PathIndicator ( currentPath: navigator . getCurrentPaths ( ) . joined ( separator: " -> " ) )
11+ PathIndicator ( currentPath: paths . joined ( separator: " -> " ) )
1212 . padding ( . top, 32 )
1313
1414 Button ( action: {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ struct Page3View: View {
88
99 var body : some View {
1010 VStack ( spacing: 30 ) {
11- PathIndicator ( currentPath: navigator . getCurrentPaths ( ) . joined ( separator: " -> " ) )
11+ PathIndicator ( currentPath: paths . joined ( separator: " -> " ) )
1212 . padding ( . top, 32 )
1313
1414 Button ( action: {
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import LinkNavigator
44struct Page4View : View {
55
66 let navigator : RootNavigatorType
7+ @State private var paths : [ String ] = [ ]
78
89 var body : some View {
910 VStack ( spacing: 30 ) {
10- PathIndicator ( currentPath: navigator . getCurrentPaths ( ) . joined ( separator: " -> " ) )
11+ PathIndicator ( currentPath: paths . joined ( separator: " -> " ) )
1112 . padding ( . top, 32 )
1213
1314 Button ( action: {
@@ -32,5 +33,8 @@ struct Page4View: View {
3233 Spacer ( )
3334 }
3435 . padding ( )
36+ . onAppear {
37+ paths = navigator. getCurrentPaths ( )
38+ }
3539 }
3640}
You can’t perform that action at this time.
0 commit comments