Created
June 26, 2017 23:55
-
-
Save KrisYu/1be1400c254d0ccda77f10cd7473503a 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
import Cocoa | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
if let url = URL(string: "https://api.github.com/users/octocat") { | |
URLSession.shared.dataTask(with: url){ data, response, error in | |
if let data = data { | |
let json = try? JSONSerialization.jsonObject(with: data, options: []) | |
print(json) | |
} | |
}.resume() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment