diff --git a/DNSecure/Views/DetailView.swift b/DNSecure/Views/DetailView.swift index 6fd1259..d33a3b1 100644 --- a/DNSecure/Views/DetailView.swift +++ b/DNSecure/Views/DetailView.swift @@ -69,18 +69,8 @@ extension DetailView: View { switch self.server.configuration { case .dnsOverTLS(let configuration): self.dnsOverTLSSections(configuration) - .onChange(of: self.focusedField) { newValue in - if newValue == nil { - self.server.configuration = .dnsOverTLS(configuration) - } - } case .dnsOverHTTPS(let configuration): self.dnsOverHTTPSSections(configuration) - .onChange(of: self.focusedField) { newValue in - if newValue == nil { - self.server.configuration = .dnsOverHTTPS(configuration) - } - } } } @@ -156,6 +146,11 @@ extension DetailView: View { } footer: { Text("The TLS name of a DNS-over-TLS server.") } + .onChange(of: self.focusedField) { newValue in + if newValue == nil { + self.server.configuration = .dnsOverTLS(configuration) + } + } } @ViewBuilder @@ -231,6 +226,11 @@ extension DetailView: View { } footer: { Text("The URL of a DNS-over-HTTPS server.") } + .onChange(of: self.focusedField) { newValue in + if newValue == nil { + self.server.configuration = .dnsOverHTTPS(configuration) + } + } } }