Created
March 9, 2017 22:07
-
-
Save jzucker2/48f5c434f34c3c4b689d0bad630c3e6c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
guard let googleURL = URL(string: "https://www.google.com") else { | |
fatalError("What went wrong?") | |
} | |
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { (_) in | |
let task = URLSession.shared.dataTask(with: googleURL) { (data, response, error) in | |
if error != nil { | |
// handle error | |
print(error.debugDescription); | |
} else { | |
// we succeeded! | |
print(data.debugDescription); | |
print(response.debugDescription); | |
} | |
} | |
task.resume(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment