Skip to content

Instantly share code, notes, and snippets.

@romanfurman6
Last active December 6, 2019 17:49
Show Gist options
  • Save romanfurman6/26b666b3d9c43320898578ea014d76c6 to your computer and use it in GitHub Desktop.
Save romanfurman6/26b666b3d9c43320898578ea014d76c6 to your computer and use it in GitHub Desktop.
func request() {
let url = URL(string: "http://424de02b.ngrok.io/web_sarvar")!
let task = URLSession.shared.dataTask(with: url) { [weak self] (data, _, _) in
guard
let data = data,
let json = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any],
let text = json["versas"] as? String
else { return }
DispatchQueue.main.async { self?.updateLabel(with: text) }
}
task.resume()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment