Skip to content

Commit 2b5da0b

Browse files
lks574interactord
authored andcommitted
fix: SingleNavigator01 - Modified CurrentPath
1 parent 50414e7 commit 2b5da0b

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

Examples/SingleNavigator/01-SingleBasic/SingleBasic/Page/Home/HomeView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import LinkNavigator
44
struct 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
}

Examples/SingleNavigator/01-SingleBasic/SingleBasic/Page/Page1/Page1View.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import LinkNavigator
44
struct 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

Examples/SingleNavigator/01-SingleBasic/SingleBasic/Page/Page2/Page2View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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: {

Examples/SingleNavigator/01-SingleBasic/SingleBasic/Page/Page3/Page3View.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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: {

Examples/SingleNavigator/01-SingleBasic/SingleBasic/Page/Page4/Page4View.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import LinkNavigator
44
struct 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
}

0 commit comments

Comments
 (0)