We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c24cff commit 3cb9330Copy full SHA for 3cb9330
Examples/LocalDebugging/MyApp/MyApp/ContentView.swift
@@ -65,13 +65,19 @@ struct ContentView: View {
65
throw CommunicationError(reason: "invald response, empty body")
66
}
67
let response = try JSONDecoder().decode(Response.self, from: data)
68
- self.response = response.message
+ self.setResponse(response.message)
69
} catch {
70
- self.response = "\(error)"
+ self.setResponse("\(error)")
71
72
73
task.resume()
74
75
+
76
+ func setResponse(_ text: String) {
77
+ DispatchQueue.main.async {
78
+ self.response = text
79
+ }
80
81
82
83
struct ContentView_Previews: PreviewProvider {
0 commit comments