Skip to content

Commit 98bcb0c

Browse files
authored
ui: settingsview use navigation stack instead of navigation view
1 parent ff3e70e commit 98bcb0c

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

BDKSwiftExampleWallet/View/SettingsView.swift

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ struct SettingsView: View {
1616

1717
var body: some View {
1818

19-
NavigationView {
19+
NavigationStack {
2020

2121
Form {
22+
2223
Section(header: Text("Network")) {
2324
if let network = viewModel.network, let url = viewModel.esploraURL {
2425
Text(network.capitalized)
@@ -39,6 +40,7 @@ struct SettingsView: View {
3940
}
4041
}
4142
}
43+
4244
Section(header: Text("Wallet")) {
4345
Button {
4446
Task {
@@ -55,22 +57,14 @@ struct SettingsView: View {
5557
.animation(.easeInOut, value: viewModel.inspectedScripts)
5658
}
5759
}
60+
5861
Section(header: Text("Danger Zone")) {
5962
Button {
6063
showingShowSeedConfirmation = true
6164
} label: {
6265
Text(String(localized: "Show Seed"))
6366
.foregroundStyle(.red)
6467
}
65-
.alert(
66-
"Are you sure you want to view the seed?",
67-
isPresented: $showingShowSeedConfirmation
68-
) {
69-
Button("Yes", role: .destructive) {
70-
isSeedPresented = true
71-
}
72-
Button("No", role: .cancel) {}
73-
}
7468
Button {
7569
showingDeleteSeedConfirmation = true
7670
} label: {
@@ -79,43 +73,49 @@ struct SettingsView: View {
7973
.foregroundStyle(.red)
8074
}
8175
}
82-
.alert(
83-
"Are you sure you want to delete the seed?",
84-
isPresented: $showingDeleteSeedConfirmation
85-
) {
86-
Button("Yes", role: .destructive) {
87-
viewModel.delete()
88-
}
89-
Button("No", role: .cancel) {}
90-
}
9176
}
77+
9278
}
9379
.navigationTitle("Settings")
9480
.onAppear {
9581
viewModel.getNetwork()
9682
viewModel.getEsploraUrl()
9783
}
98-
.sheet(
99-
isPresented: $isSeedPresented
100-
) {
101-
SeedView(viewModel: .init())
102-
.presentationDetents([.medium, .large])
103-
.presentationDragIndicator(.visible)
84+
85+
}
86+
.sheet(isPresented: $isSeedPresented) {
87+
SeedView(viewModel: .init())
88+
.presentationDetents([.medium, .large])
89+
.presentationDragIndicator(.visible)
90+
}
91+
.alert(
92+
"Are you sure you want to view the seed?",
93+
isPresented: $showingShowSeedConfirmation
94+
) {
95+
Button("Yes", role: .destructive) {
96+
isSeedPresented = true
10497
}
105-
.alert(isPresented: $viewModel.showingSettingsViewErrorAlert) {
106-
Alert(
107-
title: Text("Settings Error"),
108-
message: Text(viewModel.settingsError?.description ?? "Unknown"),
109-
dismissButton: .default(Text("OK")) {
110-
viewModel.settingsError = nil
111-
}
112-
)
98+
Button("No", role: .cancel) {}
99+
}
100+
.alert(
101+
"Are you sure you want to delete the seed?",
102+
isPresented: $showingDeleteSeedConfirmation
103+
) {
104+
Button("Yes", role: .destructive) {
105+
viewModel.delete()
113106
}
114-
107+
Button("No", role: .cancel) {}
108+
}
109+
.alert(isPresented: $viewModel.showingSettingsViewErrorAlert) {
110+
Alert(
111+
title: Text("Settings Error"),
112+
message: Text(viewModel.settingsError?.description ?? "Unknown"),
113+
dismissButton: .default(Text("OK")) {
114+
viewModel.settingsError = nil
115+
}
116+
)
115117
}
116-
117118
}
118-
119119
}
120120

121121
#if DEBUG

0 commit comments

Comments
 (0)