I have a setup like this;
startup() {
...
self.gcdWebServer.addHandlerForMethod("GET", path: "/hide",
requestClass: GCDWebServerRequest.self, asyncProcessBlock: {request in self.hide()})
...
}
func hide() -> GCDWebServerDataResponse {
self.view.hidden = true;
print("hide")
return GCDWebServerDataResponse(statusCode: 200)
}
When a request to /hide
is made, the console shows the print()
call immediately, but the view does not disappear for some arbitrary delay, somewhere between 10-30 seconds.
How can I have the request immediately result in the view being hidden?
Try this one, calling hidden on main thread.