From fd331b5fd2d7eb534c15f49ac5110f639200ed1f Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkk669@users.noreply.github.com> Date: Sun, 27 Sep 2020 18:56:10 +0900 Subject: [PATCH] Fix the crash bug (#5) Fixes #5 --- DNSecure/ContentView.swift | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/DNSecure/ContentView.swift b/DNSecure/ContentView.swift index f3e32c7..8b7ce1a 100644 --- a/DNSecure/ContentView.swift +++ b/DNSecure/ContentView.swift @@ -12,6 +12,7 @@ struct ContentView { @AppStorage("servers") var servers = Presets.servers @AppStorage("usedID") var usedID: String? @State var isEnabled = false + @State var selection: Int? func addNewDoTServer() { self.servers.append( @@ -20,6 +21,7 @@ struct ContentView { configuration: .dnsOverTLS(DoTConfiguration()) ) ) + self.selection = self.servers.count - 1 } func addNewDoHServer() { @@ -29,6 +31,7 @@ struct ContentView { configuration: .dnsOverHTTPS(DoHConfiguration()) ) ) + self.selection = self.servers.count - 1 } func updateStatus() { @@ -70,43 +73,52 @@ extension ContentView: View { NavigationView { List { Section(header: Text("Servers")) { - ForEach(0..