Last active
December 6, 2019 17:49
-
-
Save romanfurman6/26b666b3d9c43320898578ea014d76c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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